基本命令

ls -a: 包含.和..
ls -A: 不包含.和..
ls -h: GB/MB/KB
ls -i: inode
ls -n: UID/GID
ls -r: 倒序
ls -R: 子目录
ls -S: 按文件大小排序
ls -t: 按时间排序

cp -a: pdr
cp -d: 复制link文件本身,而不是link指向的文件
cp -f: 目标文件无法打开,直接删掉
cp -l : hard link
cp -s: symbolic link
cp -r: 递归目录复制
cp -u: update

od -t TYPE
a: default byte
c: ASCII byte
d: decimal
f: floating
o: octal
x: hexadecimal

od -t oCc /etc/issue
od -t c /usr/bin/passwd

touch
-a change only the access time
-c, –no-create do not create any files
-d, –date=STRING parse STRING and use it instead of current time
-m change only the modification time
-r, –reference=FILE use this file’s times instead of current time
-t STAMP use [[CC]YY]MMDDhhmm[.ss] instead of current time

eg:
touch -d “3 days ago” myfile # -rw-r—– 1 bmpscp sms 307891 2013-06-17 14:27 myfile

touch -t 0709101347 myfile # -rw-r—– 1 bmpscp sms 307891 2007-09-10 13:47 myfile

关机/重启系统
数据同步:sync
关机指令:shutdown
重启关机: reboot, halt, poweroff

shutdown -h now
shutdown -h 20:10
shutdown -h +10 # shutdown after 10 minutes
shutdown -r now # reboot immediately
shutdown -r +30 ‘The system will reboot’
shutdown -k now ‘The system will reboot’ # frighten you

nl: number lines of files
-b, –body-numbering=STYLE use STYLE for numbering body lines
STYLE is one of:
a number all lines
t number only nonempty lines
n number no lines

eg:
nl -b a myfile <=> cat -n myfile
nl -b t myfile <=> cat -b myfile

-n, –number-format=FORMAT insert line numbers according to FORMAT
FORMAT is one of:
ln left justified, no leading zeros
rn right justified, no leading zeros
rz right justified, leading zeros

-w, –number-width=NUMBER use NUMBER columns for line numbers

eg:
nl -b a -n rz -w 3 /etc/issue
001
002 Welcome to SUSE Linux Enterprise Server 10 SP1 (x86_64) - Kernel \r (\l).
003
004

文件修改时间:
modification time (mtime): 文件内容变更时改变
status time (ctime): 文件状态(即权限)变更时改变
access time (atime): 被读取后变更

diff & cmp:
diff: 比较文本文件和目录
cmp:可以用于二进制文件,用byte比较

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值