Linux · 2008-12-10

linux常用命令

linux常用命令备忘录.
兴许我们都遗忘了一些有用的命令~ 例如man,我们都知道man是用来查看命令的信息,例如

root@debian:~# man ping

这样能查出ping命令的一些有用的信息及选项,例如:

-c count
Stop after sending count ECHO_REQUEST packets. With deadline option, ping waits for count ECHO_REPLY packets,
until the timeout expires.

那就能告诉我们, -c 是count 也就是ping的次数,这样我们就能方便的操作ping命令,例如:


root@debian:~# ping www.baidu.com -c 3
PING www.a.shifen.com (121.14.88.14) 56(84) bytes of data.
64 bytes from 121.14.88.14: icmp_seq=1 ttl=53 time=13.8 ms
64 bytes from 121.14.88.14: icmp_seq=2 ttl=53 time=12.4 ms
64 bytes from 121.14.88.14: icmp_seq=3 ttl=53 time=12.7 ms

— www.a.shifen.com ping statistics —
3 packets transmitted, 3 received, 0% packet loss, time 2004ms
rtt min/avg/max/mdev = 12.471/13.028/13.839/0.586 ms

这样就能得到 ping 3次www.baidu.com的信息


还有系统自带的日历 ^ ^

root@debian:~# ncal
December 2008
Mo 1 8 15 22 29
Tu 2 9 16 23 30
We 3 10 17 24 31
Th 4 11 18 25
Fr 5 12 19 26
Sa 6 13 20 27
Su 7 14 21 28
root@debian:~# cal
December 2008
Su Mo Tu We Th Fr Sa
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31



还有mkdir的”-p”选项 ,快速依层次创建目录.

-p, –parents
no error if existing, make parent directories as needed

那就很方便啦.

root@debian:~# mkdir -p ~/aaa/bbb/ccc/ddd
root@debian:~# cd aaa/bbb/ccc/ddd/
root@debian:~/aaa/bbb/ccc/ddd#



还有文件从写

root@debian:~# cat dead.letter
aaaa
root@debian:~# cp /dev/null dead.letter
root@debian:~# cat dead.letter
root@debian:~#

时间仓促,最近比较忙,没多少时间学习,不过我会争取每天都学一点!