系統(tǒng)之家 - 系統(tǒng)光盤下載網(wǎng)站!

當(dāng)前位置:系統(tǒng)之家 > 系統(tǒng)教程 > Linux使用ss命令查看socket狀態(tài)

Linux如何使用ss命令查看socket狀態(tài)(2)

時間:2014-12-30 17:51:04 作者:qipeng 來源:系統(tǒng)之家 1. 掃描二維碼隨時看資訊 2. 請使用手機(jī)瀏覽器訪問: https://m.xitongzhijia.net/xtjc/20141230/33791.html 手機(jī)查看 評論

  代碼如下:

 。踨oot@localhost ~]# ss -s

  Total: 34 (kernel 48)

  TCP: 4 (estab 1, closed 0, orphaned 0, synrecv 0, timewait 0/0), ports 3《/p》 《p》Transport Total IP IPv6

  * 48 - -

  RAW 0 0 0

  UDP 5 5 0

  TCP 4 4 0

  INET 9 9 0

  FRAG 0 0 0

 。踨oot@localhost ~]#

  說明:列出當(dāng)前的established, closed, orphaned and waiting TCP sockets

  實(shí)例3:列出所有打開的網(wǎng)絡(luò)連接端口

  命令:ss -l

  輸出:

  代碼如下:

 。踨oot@localhost ~]# ss -l

  Recv-Q Send-Q Local Address:Port Peer Address:Port

  0 0 127.0.0.1:smux *:*

  0 0 *:3690 *:*

  0 0 *:ssh *:*

 。踨oot@localhost ~]#

  實(shí)例4:查看進(jìn)程使用的socket

  命令:ss -pl

  輸出:

  代碼如下:

 。踨oot@localhost ~]# ss -pl

  Recv-Q Send-Q Local Address:Port Peer Address:Port

  0 0 127.0.0.1:smux *:* users:((“snmpd”,2716,8))

  0 0 *:3690 *:* users:((“svnserve”,3590,3))

  0 0 *:ssh *:* users:((“sshd”,2735,3))

 。踨oot@localhost ~]#

  實(shí)例5:找出打開套接字/端口應(yīng)用程序

  命令:ss -lp | grep 3306

  輸出:

  代碼如下:

  [root@localhost ~]# ss -lp|grep 1935

  0 0 *:1935 *:* users:((“fmsedge”,2913,18))

  0 0 127.0.0.1:19350 *:* users:((“fmsedge”,2913,17))

  [root@localhost ~]# ss -lp|grep 3306

  0 0 *:3306 *:* users:((“mysqld”,2871,10))

 。踨oot@localhost ~]#

  實(shí)例6:顯示所有UDP Sockets

  命令:ss -u -a

  輸出:

  代碼如下:

 。踨oot@localhost ~]# ss -u -a

  State Recv-Q Send-Q Local Address:Port Peer Address:Port

  UNCONN 0 0 127.0.0.1:syslog *:*

  UNCONN 0 0 *:snmp *:*

  ESTAB 0 0 192.168.120.203:39641 10.58.119.119:domain

 。踨oot@localhost ~]#

  實(shí)例7:顯示所有狀態(tài)為established的SMTP連接

  命令:ss -o state established ‘( dport = :smtp or sport = :smtp )’

  輸出:

  代碼如下:

 。踨oot@localhost ~]# ss -o state established ‘( dport = :smtp or sport = :smtp )’

  Recv-Q Send-Q Local Address:Port Peer Address:Port

 。踨oot@localhost ~]#

  實(shí)例8:顯示所有狀態(tài)為Established的HTTP連接

  命令:ss -o state established ‘( dport = :http or sport = :http )’

  輸出:

  代碼如下:

  [root@localhost ~]# ss -o state established ‘( dport = :http or sport = :http )’

  Recv-Q Send-Q Local Address:Port Peer Address:Port

  0 0 75.126.153.214:2164 192.168.10.42:http

 。踨oot@localhost ~]#

標(biāo)簽 命令 ss

發(fā)表評論

0

沒有更多評論了

評論就這些咯,讓大家也知道你的獨(dú)特見解

立即評論

以上留言僅代表用戶個人觀點(diǎn),不代表系統(tǒng)之家立場

其他版本軟件

熱門教程

人氣教程排行

Linux系統(tǒng)推薦

官方交流群 軟件收錄