显示消耗内存CPU最多的10个进程
ps aux|sort -nrk +3|head -10
ps aux|sort -nk +3 |tail -10
显示消耗内存MEM最多的10个进程
ps aux|sort -nrk +4|head -10
ps aux|sort -nk +4 |tail -10
----------------------------------------------------------------------------
2.查看Apache的并发请求数及其TCP连接状态
netstat -n|awk '/^tcp/ {++S[$NF]} END {for (a in S) print a, S[a]}'
------------------------------------------------------------------------------
3.找出自己最常用的10条命令及使用次数(或求访问最多的ip数)
sed -e ‘s/| /\n/g’ ~/.bash_history |cut -d ‘ ‘ -f 1 | sort | uniq -c | sort -nr | head
——————————————————————————————————————————
4.日志中第10个字段表示连接时间,求平均连接时间
cat access_log |grep “connect cbp” |awk
‘BEGIN{sum=0;count=0;}{sum+=$10;count++;}END{printf(“sum=%d,count=%d,avg=%f\n”,sum,count,
sum/count)}’
——