监控网络状态 netstat
基本语法
netstat [选项]
选项 | 说明 |
---|---|
-an | 按一定顺序排列输出 |
-p | 显示哪个进程在调用 |
netstat -anp
[root@blog ~]# netstat -anp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:12222 0.0.0.0:* LISTEN 1236/sshd
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 1335/mysqld
tcp 0 0 10.0.4.11:48778 169.254.0.55:5574 ESTABLISHED 1833/YDService
tcp 0 52 10.0.4.11:12222 113.249.215.221:6034 ESTABLISHED 9975/sshd: root@pts
netstat -tlunp
[root@blog ~]# netstat -tlunp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:12222 0.0.0.0:* LISTEN 1236/sshd
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 1335/mysqld
tcp6 0 0 :::80 :::* LISTEN 4111/httpd
tcp6 0 0 :::12222 :::* LISTEN 1236/sshd
udp 0 0 0.0.0.0:68 0.0.0.0:* 981/dhclient