hackin 发表于 2010-7-12 16:55:20

提供一些实用的正则表达式

1.查看http的并发请求数及其TCP连接状态
netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S}'

2.按内存从大到小排列
ps -e-o "%C: %p : %z : %a"|sort -k5 -nr

3.按cpu利用率从大到小排列
ps -e-o "%C: %p : %z : %a"|sort-nr

4.打印说cache里的URL
grep -r -ajpg /data/cache/* | strings | grep "http:" | awk -F'http:' '{print "http:"$2;}'

5.如何杀掉mysql进程
ps aux|grep mysql|grep -v grep|awk '{print $2}'|xargs kill -9
pgrep mysql |xargs kill -9

6.显示运行3级别开启的服务
ls /etc/rc3.d/S* |cut -c 15-

7.CPU的数量多核算多个CPU
cat /proc/cpuinfo |grep -c processor
页: [1]
查看完整版本: 提供一些实用的正则表达式