HOBALL 筆記簿

October 14, 2009

Useful Linux commands #2

Filed under: Linux — Tags: , , — hoball @ 5:21 pm
ps -efww|grep sqlr-listener|grep -v grep|cut -c 9-15|xargs kill -9
实 时查看正在执行的sql语句
/usr/sbin/tcpdump -i eth0 -s 0 -l -w - dst port 3306 | strings | egrep -i 'SELECT|UPDATE|DELETE|INSERT|SET|COMMIT|ROLLBACK|CREATE|DROP|ALTER|CALL'
查看http连接
netstat -n | awk '/^tcp/ {++state[$NF]} END {for(key in state) print key,"t",state[key]}'
查看SYN状态的http连接
netstat -an | grep SYN | awk '{print $5}' | awk -F: '{print $1}' | sort | uniq -c | sort -nr | more

查看TIME_WAIT状态的http连接

netstat -tna | cut -b 49- |grep TIME_WAIT | sort |morenetstat -an | grep TIME_WAIT | awk '{print $5}' | awk -F: '{print $1}' | sort | uniq -c | sort -nr | more

查看ESTABLISHED状态的http连接

netstat -an | grep ESTABLISHED | awk '{print $5}' | awk -F: '{print $1}' | sort | uniq -c | sort -nr | morenetstat -an | grep ":80" | grep ESTABLISHED | sort | more

批量kill进程

ps -efww|grep sqlr-listener|grep -v grep|cut -c 9-15|xargs kill -9

查看活动的php-cgi连接数

netstat -anpo|grep php-cgi|wc -l
Source: http://www.quit8.com/read.php/18.htm

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: