熱搜:win11繞過硬件限制安裝 一鍵重裝Win10系統(tǒng) 最干凈的u盤啟動(dòng)盤 真正純凈版的win7系統(tǒng)
時(shí)間:2014-12-30 15:59:47 作者:qipeng 來源:系統(tǒng)之家 1. 掃描二維碼隨時(shí)看資訊 2. 請(qǐng)使用手機(jī)瀏覽器訪問: https://m.xitongzhijia.net/xtjc/20141230/33733.html 手機(jī)查看 評(píng)論 反饋
輸出:
代碼如下:
。踨oot@localhost ~]# netstat -l
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 localhost:smux *:* LISTEN
tcp 0 0 *:svn *:* LISTEN
tcp 0 0 *:ssh *:* LISTEN
udp 0 0 localhost:syslog *:*
udp 0 0 *:snmp *:*
Active UNIX domain sockets (only servers)
Proto RefCnt Flags Type State I-Node Path
unix 2 [ ACC ] STREAM LISTENING 708833 /tmp/ssh-yKnDB15725/agent.15725
unix 2 [ ACC ] STREAM LISTENING 7296 /var/run/audispd_events
。踨oot@localhost ~]#
實(shí)例9:顯示所有已建立的有效連接
命令:netstat -n
輸出:
代碼如下:
。踨oot@localhost ~]# netstat -n
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 268 192.168.120.204:22 10.2.0.68:62420 ESTABLISHED
Active UNIX domain sockets (w/o servers)
Proto RefCnt Flags Type State I-Node Path
unix 2 [ ] DGRAM 1491 @/org/kernel/udev/udevd
unix 4 [ ] DGRAM 7337 /dev/log
unix 2 [ ] DGRAM 708823
unix 2 [ ] DGRAM 7539
unix 3 [ ] STREAM CONNECTED 7287
unix 3 [ ] STREAM CONNECTED 7286
。踨oot@localhost ~]#
實(shí)例10:顯示關(guān)于以太網(wǎng)的統(tǒng)計(jì)數(shù)據(jù)
命令:netstat -e
輸出:
代碼如下:
[root@localhost ~]# netstat -e
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State User Inode
tcp 0 248 192.168.120.204:ssh 10.2.0.68:62420 ESTABLISHED root 708795
Active UNIX domain sockets (w/o servers)
Proto RefCnt Flags Type State I-Node Path
unix 2 [ ] DGRAM 1491 @/org/kernel/udev/udevd
unix 4 [ ] DGRAM 7337 /dev/log
unix 2 [ ] DGRAM 708823
unix 2 [ ] DGRAM 7539
unix 3 [ ] STREAM CONNECTED 7287
unix 3 [ ] STREAM CONNECTED 7286
。踨oot@localhost ~]#
說明:
用于顯示關(guān)于以太網(wǎng)的統(tǒng)計(jì)數(shù)據(jù)。它列出的項(xiàng)目包括傳送的數(shù)據(jù)報(bào)的總字節(jié)數(shù)、錯(cuò)誤數(shù)、刪除數(shù)、數(shù)據(jù)報(bào)的數(shù)量和廣播的數(shù)量。這些統(tǒng)計(jì)數(shù)據(jù)既有發(fā)送的數(shù)據(jù)報(bào)數(shù)量,也有接收的數(shù)據(jù)報(bào)數(shù)量。這個(gè)選項(xiàng)可以用來統(tǒng)計(jì)一些基本的網(wǎng)絡(luò)流量)
實(shí)例11:顯示關(guān)于路由表的信息
命令:netstat -r
輸出:
代碼如下:
。踨oot@localhost ~]# netstat -r
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.120.0 * 255.255.255.0 U 0 0 0 eth0
192.168.0.0 192.168.120.1 255.255.0.0 UG 0 0 0 eth0
10.0.0.0 192.168.120.1 255.0.0.0 UG 0 0 0 eth0
default 192.168.120.240 0.0.0.0 UG 0 0 0 eth0
[root@localhost ~]#
實(shí)例12:列出所有 tcp 端口
命令:netstat -at
輸出:
代碼如下:
。踨oot@localhost ~]# netstat -at
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 localhost:smux *:* LISTEN
tcp 0 0 *:svn *:* LISTEN
tcp 0 0 *:ssh *:* LISTEN
tcp 0 284 192.168.120.204:ssh 10.2.0.68:62420 ESTABLISHED
[root@localhost ~]#
實(shí)例13:統(tǒng)計(jì)機(jī)器中網(wǎng)絡(luò)連接各個(gè)狀態(tài)個(gè)數(shù)
命令:netstat -a | awk ‘/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}’
輸出:
代碼如下:
。踨oot@localhost ~]# netstat -a | awk ‘/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}’
ESTABLISHED 1
LISTEN 3
。踨oot@localhost ~]#
實(shí)例14:把狀態(tài)全都取出來后使用uniq -c統(tǒng)計(jì)后再進(jìn)行排序
命令:netstat -nat |awk ‘{print $6}’|sort|uniq -c
輸出:
代碼如下:
[root@andy ~]# netstat -nat |awk ‘{print $6}’|sort|uniq -c
14 CLOSE_WAIT
1 established)
578 ESTABLISHED
1 Foreign
43 LISTEN
5 TIME_WAIT
。踨oot@andy ~]# netstat -nat |awk ‘{print $6}’|sort|uniq -c|sort -rn
576 ESTABLISHED
43 LISTEN
14 CLOSE_WAIT
5 TIME_WAIT
1 Foreign
1 established)
[root@andy ~]#
發(fā)表評(píng)論
共0條
評(píng)論就這些咯,讓大家也知道你的獨(dú)特見解
立即評(píng)論以上留言僅代表用戶個(gè)人觀點(diǎn),不代表系統(tǒng)之家立場(chǎng)