-a 表示显示所有的状态
-l 则只是显示listen状态的,缺省只是显示connected
-p 显示应用程序的名字
-n 显示ip、port和user等信息
-t 只显示TCP的连接
/> netstat -apnt
/> netstat -lpnt #如果只是显示监听端口的状态,可以使用该命令
10. tune2fs:
调整ext2/ext3文件系统特性的工具
-l 查看文件系统信息
/> tune2fs -l /dev/sda1 #将会列出所有和该磁盘分区相关的数据信息,如Inode等。
/> tune2fs -l /dev/sda1 | grep -i "block size" #查看当前文件系统的块儿尺寸
/> tune2fs -l /dev/sdb1 |grep -i "mount count" #查看 mount count 挂载次数
11. 开启或关闭Linux(iptables)防火墙
重启后永久性生效:
/> chkconfig iptables on #开启
/> chkconfig iptables off #关闭
即时生效,重启后还原:
/> service iptables start #开启
/> service iptables stop #关闭
12. tar 分卷压缩和合并
以每卷500M为例
/>tar cvzpf - somedir | split -d -b 500m #tar分卷压缩
/>cat x* > mytarfile.tar.gz #tar多卷合并
13. 把man或info的信息存为文本文件
/> man tcsh | col -b > tcsh.txt
/> info tcsh -o tcsh.txt -s
14. 查看正在执行进程的线程数
/>ps -eo "args nlwp pid pcpu"
15. 使用md5sum计算文件的md5
/> md5sum test.c
07af691360175a6808567e2b08a11724 test.c
/> md5sum test.c > hashfile
/> md5sum –c hashfile # 验证hashfile中包含的md5值和对应的文件,在执行该命令时是否仍然匹配, 如果此时test.c被修改了,该命令将返回不匹配的警告.
16. 在ps命令中显示进程的完整的命令行参数
/>ps auwwx