ss 命令使用

 ss (小寫)命令 是可以查看tcp/ip socket 連線狀態指令, 類似netstat 命令, 有興趣可試試!! 

習慣先查看有那些參數可用
[[email protected] ~]# ss -h
Usage: ss [ OPTIONS ] ss [ OPTIONS ] [ FILTER ] -h, --help           this message
-V, --version        output version information
-n, --numeric        don't resolve service names
-r, --resolve       resolve host names
-a, --all            display all sockets   -l, --listening      display listening sockets
-o, --options       show timer information
-e, --extended      show detailed socket information
-m, --memory        show socket memory usage
-p, --processes      show process using socket
-i, --info           show internal TCP information
-s, --summary        show socket usage summary
-4, --ipv4          display only IP version 4 sockets
-6, --ipv6          display only IP version 6 sockets
-0, --packet display PACKET sockets
-t, --tcp            display only TCP sockets
-u, --udp            display only UDP sockets   -d, --dccp           display only DCCP sockets
-w, --raw            display only RAW sockets
-x, --unix           display only Unix domain sockets
-f, --family=FAMILY display sockets of type FAMILY
-A, --query=QUERY
QUERY := {all|inet|tcp|udp|raw|unix|packet|netlink}[,QUERY] -F, --filter=FILE   read filter information from FILE
FILTER := [ state TCP-STATE ] [ EXPRESSION ]

例子1   查看Summary
[[email protected] ~]# ss -s
Total: 648 (kernel 660)
TCP:   23 (estab 5, closed 9, orphaned 1, synrecv 0, timewait 9/0), ports 0
Transport Total     IP        IPv6
*         660       -         -
RAW       0         0         0
UDP       10        7         3
TCP       14        11        3
INET      24        18        6
FRAG      0         0         0

例子2   查看Listen port
[[email protected] ~]# ss -l
Recv-Q Send-Q                     Local Address:Port                                                  Peer Address:Port
0      128                                  192.168.11.200:ssh                                                      *:*
0      128                                    127.0.0.1:ipp                                                              *:*
0      128                                                ::1:ipp                                                              :::*
0      10                                      127.0.0.1:smtp                                                            *:*
0      128                                                 *:34494                                                         *:*
0      128                                                 :::55498                                                          :::*
0      128                                                 :::sunrpc                                                          :::*
0      128                                                 *:sunrpc                                                         *:*
# ss -atn   //表示列出(a=all; t=tcp; n=不解析服務名稱 ex:http(80) ,ssh(22)....)

點閱: 495

By tony

自由軟體愛好者~喜歡不斷的思考各種問題,有新的事物都會想去學習嘗試 做實驗並熱衷研究 沒有所謂頂天的技術 只有謙虛及不斷的學習 精進專業,本站主要以分享系統及網路相關知識、資源而建立。 Github http://stnet253.github.io

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料