linux 查找流量異常並終止
展開
1、安裝nethogs工具,然後 root 運行nethogs
查看Sent (服務器往外發,比如下載)或Receive(服務器接收,比如上傳)流量比較大的PID
2、然後根據PID 查到是哪個進程 ps -ef | grep pid
[root@localhost ~]# ps -ef | grep 11865
root 11865 22449 33 19:05 ? 00:00:32 sshd: root@notty
root 11867 11865 2 19:05 ? 00:00:02 /usr/libexec/openssh/sftp-server
root 11899 11809 0 19:06 pts/2 00:00:00 grep 11865
然後根據查找到的pid,kill -9 11867 即可結束異常進程。