Skip to main content

Finding listening ports on any operating system

 

 

ss - the new netstat

# show number listening process
ss -nlp | grep -e ^tcp -e ^tcp6 -e ^udp -e ^udp6

Output

udp   UNCONN 0      0                                   127.0.0.53%lo:53               0.0.0.0:*    users:(("systemd-resolve",pid=1985,fd=13))
udp   UNCONN 0      0                                    10.32.57.255:137              0.0.0.0:*    users:(("nmbd",pid=2033,fd=16))
udp   UNCONN 0      0                                      10.32.57.3:137              0.0.0.0:*    users:(("nmbd",pid=2033,fd=15))
udp   UNCONN 0      0                                         0.0.0.0:137              0.0.0.0:*    users:(("nmbd",pid=2033,fd=13))
udp   UNCONN 0      0                                    10.32.57.255:138              0.0.0.0:*    users:(("nmbd",pid=2033,fd=18))
udp   UNCONN 0      0                                      10.32.57.3:138              0.0.0.0:*    users:(("nmbd",pid=2033,fd=17))
udp   UNCONN 0      0                                         0.0.0.0:138              0.0.0.0:*    users:(("nmbd",pid=2033,fd=14))
udp   UNCONN 0      0                                         0.0.0.0:44900            0.0.0.0:*    users:(("avahi-daemon",pid=2020,fd=14))
udp   UNCONN 0      0                                         0.0.0.0:5353             0.0.0.0:*    users:(("avahi-daemon",pid=2020,fd=12))
udp   UNCONN 0      0                                            [::]:33933               [::]:*    users:(("avahi-daemon",pid=2020,fd=15))
udp   UNCONN 0      0                                            [::]:5353                [::]:*    users:(("avahi-daemon",pid=2020,fd=13))
tcp   LISTEN 0      4096                                127.0.0.53%lo:53               0.0.0.0:*    users:(("systemd-resolve",pid=1985,fd=14))
tcp   LISTEN 0      128                                       0.0.0.0:22               0.0.0.0:*    users:(("sshd",pid=2231,fd=3))
tcp   LISTEN 0      10                                      127.0.0.1:25               0.0.0.0:*    users:(("sendmail-mta",pid=2872,fd=4))
tcp   LISTEN 0      50                                        0.0.0.0:445              0.0.0.0:*    users:(("smbd",pid=2438,fd=46))
tcp   LISTEN 0      16                                      127.0.0.1:3493             0.0.0.0:*    users:(("upsd",pid=2410,fd=4))
tcp   LISTEN 0      80                                      127.0.0.1:3306             0.0.0.0:*    users:(("mariadbd",pid=2367,fd=28))
tcp   LISTEN 0      10                                      127.0.0.1:587              0.0.0.0:*    users:(("sendmail-mta",pid=2872,fd=5))
tcp   LISTEN 0      50                                        0.0.0.0:139              0.0.0.0:*    users:(("smbd",pid=2438,fd=47))
tcp   LISTEN 0      128                                          [::]:22                  [::]:*    users:(("sshd",pid=2231,fd=4))
tcp   LISTEN 0      50                                           [::]:445                 [::]:*    users:(("smbd",pid=2438,fd=44))
tcp   LISTEN 0      16                                          [::1]:3493                [::]:*    users:(("upsd",pid=2410,fd=5))
tcp   LISTEN 0      50                                           [::]:139                 [::]:*    users:(("smbd",pid=2438,fd=45))

#end