大話命令之--ss,大話--ss

來源:互聯網
上載者:User

大話命令之--ss,大話--ss

大話命令之—ss

ss是Socket Statistics的縮寫。顧名思義,ss命令可以用來擷取socket統計資訊,它可以顯示和netstat類似的內容。

優勢:

(1)顯示更多更詳細的有關TCP和串連狀態的資訊,(2)比netstat更快速更高效。

1 格式

    格式:ss    [option]…    [filter]

netstat 通過遍曆proc來或許socket資訊,ss使用netlink與核心tcp_diag模組通訊擷取socket資訊

2 選項

    -t:tcp 協議相關

    -u:udp協議相關

    -w:裸通訊端相關

    -l:listen狀態的串連

    -a:所有

    -n:數字格式

    -p:相關的程式和PID

    -e:擴充的資訊

    -m:記憶體用量

    -o:計時器資訊

3 執行個體

(1)ss -l 顯示本地開啟的所有連接埠

[root@CentOS68 ~]# ss -l

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

LISTEN 0 128 *:60455 *:*

LISTEN 0 128 :::sunrpc :::*

LISTEN 0 128 *:sunrpc *:*

LISTEN 0 128 :::http :::*

LISTEN 0 128 :::ssh :::*

LISTEN 0 128 *:ssh *:*

LISTEN 0 128 127.0.0.1:ipp *:*

LISTEN 0 128 ::1:ipp :::*

LISTEN 0 100 ::1:smtp :::*

LISTEN 0 100 127.0.0.1:smtp *:*

LISTEN 0 128 :::39546 :::*

[root@CentOS68 ~]#

(2)ss –pl 顯示每個進程具體開啟的socket

[root@CentOS68 ~]# ss -pl

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

LISTEN 0 128 *:60455 *:* users:(("rpc.statd",1644,9))

LISTEN 0 128 :::sunrpc :::* users:(("rpcbind",1601,11))

LISTEN 0 128 *:sunrpc *:* users:(("rpcbind",1601,8))

LISTEN 0 128 *:ssh *:* users:(("sshd",1841,3))

LISTEN 0 128 127.0.0.1:ipp *:* users:(("cupsd",1679,7))

LISTEN 0 128 ::1:ipp :::* users:(("cupsd",1679,6))

LISTEN 0 100 ::1:smtp :::* users:(("master",1955,13))

LISTEN 0 100 127.0.0.1:smtp *:* users:(("master",1955,12))

LISTEN 0 128 :::39546 :::* users:(("rpc.statd",1644,11))

(3)-t -a 顯示所有tcp socket

[root@CentOS68 ~]# ss -t -a

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

LISTEN 0 128 *:60455 *:*

LISTEN 0 128 :::sunrpc :::*

LISTEN 0 128 *:sunrpc *:*

LISTEN 0 128 :::http :::*

LISTEN 0 128 :::ssh :::*

LISTEN 0 128 *:ssh *:*

LISTEN 0 128 127.0.0.1:ipp *:*

LISTEN 0 128 ::1:ipp :::*

LISTEN 0 100 ::1:smtp :::*

LISTEN 0 100 127.0.0.1:smtp *:*

LISTEN 0 128 :::39546 :::*

ESTAB 0 64 192.168.29.68:ssh 192.168.29.1:50541

(4)-u -a 顯示所有的udp socket

[root@CentOS68 ~]# ss -u -a

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

UNCONN 0 0 *:sunrpc *:*

UNCONN 0 0 *:39797 *:*

UNCONN 0 0 *:ipp *:*

UNCONN 0 0 *:928 *:*

UNCONN 0 0 *:bootpc *:*

UNCONN 0 0 127.0.0.1:972 *:*

UNCONN 0 0 :::59503 :::*

UNCONN 0 0 :::sunrpc :::*

UNCONN 0 0 :::928 :::*

(5)ss -o 顯示所有已建立的串連

[root@CentOS68 ~]# ss -o

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

ESTAB 0 64 192.168.29.68:ssh 192.168.29.1:50541 timer:(on,442ms,0)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.