linux常用命令

1、删除0字节文件

find -type f -size 0 -exec rm -rf {} ;

2、查看 http 的并发请求数及其 TCP 连接状态:

netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'

3、取 IP 地址

ifconfig eth0 |grep "inet addr:" |awk '{print $2}'| cut -c 6-
OR
ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'

4、查看80端口建立连接

netstat -an -t | grep ":80" | grep ESTABLISHED | awk '{printf "%s %s
",$5,$6}' | sort

5、打开文件数目

lsof | wc -l
o(=•ェ•=)m纸上得来终觉浅,绝知此事要躬行o(=•ェ•=)m
原文地址:https://www.cnblogs.com/occl/p/14117987.html