Linux下删除名字乱码的文件或者文件夹
有时会遇到类似于20P)Ò
这样的文件夹或者文件,可以查找文件的inode,然后使用find命令删除
使用ls -i
可以查看文件或者文件夹的inode
3146 20P)Ò
然后使用命令find . -inum 3146 -exec rm -r {} \;
将其删除
注意: 如果是文件的话,命令中的
-r
参数就不需要了
More
Linux下删除名字乱码的文件
SunOS上获取以前的日期
# 获得五天以前的日期, 假设今天是20141030, 那么将得到20141025
perl -MPOSIX -le 'print strftime "%Y-%m-%d", localtime(time - 3600*24*5)'
# 你也可以使用TimeZone的写法, EST是时区, 120=24*5
5DaysBefore=`TZ="EST125EDT" date +'%Y-%m-%d'`
# 这是在GNU date下的写法(无法在SunOS下使用)
date +%Y-%m-%d -d '5 days ago'
During a session, sometimes we have a need to change the system time for our session only. We have used it to simulate time based testing.
Format
TZ=ESThhEDT
The EST set your time to Eastern Standard Time and EDT is Eastern Daylight Time.
hh is the number of hours you wish to change.
Example: Currently the system(
date
)
date isThu Apr 9 02:31:10 EDT 2015
And you wish to set it to yesterday at the same time. You would substitute a positive 29 for hh.
Now the shell time is(
TZ=EST29EDT date
):
Wed Apr 8 02:31:14 EDT 2015
Why 29 and not 24? The main UNIX clock is set from GMT not EST therefore you have to add 5 hours to your backward calculations to get the same exact time since EST is GMT - 5 hours.
Use negitive numbers to set the clock into the future.
Also if you need to set the minutes and seconds it is hh:mm:ss. These are all the number of hours, minutes and seconds from GMT that you wish to set.
This is for Solaris 10.
如果要显示各个时区的时间, 可以使用诸如TZ=PRC date
命令(显示中国北京时间). 有很多时区可以选择, 可以进入目录/usr/share/lib/zoneinfo查看.
未完待续…… 最后更新 2015/06/25