The ss command. A very useful way to find open and listening ports on a Linux system.

The ss command for Linux allows a user to list all listening ports on a Linux system.

This command lists all listening TCP ports.

[email protected] ~ $ ss -l -t
State       Recv-Q Send-Q                          Local Address:Port                              Peer Address:Port   
LISTEN      0      1                                   127.0.0.1:4101                                         *:*       
LISTEN      0      50                                          *:netbios-ssn                                      *:*       
LISTEN      0      128                                         *:sunrpc                                       *:*       
LISTEN      0      128                                 127.0.0.1:ipp                                          *:*       
LISTEN      0      128                                         *:https                                        *:*       
LISTEN      0      50                                          *:microsoft-ds                                      *:*       
LISTEN      0      50                                         :::netbios-ssn                                     :::*       
LISTEN      0      128                                        :::sunrpc                                      :::*       
LISTEN      0      128                                       ::1:ipp                                         :::*       
LISTEN      0      128                                        :::https                                       :::*       
LISTEN      0      50                                         :::microsoft-ds                                     :::*

And this is how to list all listening UDP ports.

[email protected] ~ $ ss -l -u
State       Recv-Q Send-Q                          Local Address:Port                              Peer Address:Port   
UNCONN      0      0                                           *:bootpc                                       *:*       
UNCONN      0      0                                           *:sunrpc                                       *:*       
UNCONN      0      0                               192.168.100.4:ntp                                          *:*       
UNCONN      0      0                                   127.0.0.1:ntp                                          *:*       
UNCONN      0      0                                           *:ntp                                          *:*       
UNCONN      0      0                             192.168.100.255:netbios-ns                                      *:*       
UNCONN      0      0                               192.168.100.4:netbios-ns                                      *:*       
UNCONN      0      0                                           *:netbios-ns                                      *:*       
UNCONN      0      0                             192.168.100.255:netbios-dgm                                      *:*       
UNCONN      0      0                               192.168.100.4:netbios-dgm                                      *:*       
UNCONN      0      0                                           *:netbios-dgm                                      *:*       
UNCONN      0      0                                           *:12931                                        *:*       
UNCONN      0      0                                           *:913                                          *:*       
UNCONN      0      0                                           *:mdns                                         *:*       
UNCONN      0      0                                           *:1900                                         *:*       
UNCONN      0      0                                           *:60439                                        *:*       
UNCONN      0      0                                          :::sunrpc                                      :::*       
UNCONN      0      0                   fe80::fa1a:67ff:fe10:b163:ntp                                         :::*       
UNCONN      0      0                             fe80::7a94:7b57:ntp                                         :::*       
UNCONN      0      0                        2001:470:1f06:1b5::2:ntp                                         :::*       
UNCONN      0      0                                         ::1:ntp                                         :::*       
UNCONN      0      0                                          :::ntp                                         :::*       
UNCONN      0      0                                          :::53609                                       :::*       
UNCONN      0      0                                          :::913                                         :::*       
UNCONN      0      0                                          :::mdns                                        :::*       
UNCONN      0      0                                          :::1865                                        :::*

The output of the ss command is very much like the familiar netstat command; but this command has greater capabilities.

Type: ss -a to list listening and non-listening ports.

The ss -i command will list all internal TCP information. This is therefore a very useful alternative to the traditionally used netstat utility.

No comments have been made. Use this form to start the conversation :)

Leave a Reply