HOW TO : Find out which network port a program is using in linux

Quick way to figure out, which ports a particular program is using in linux

 netstat -plan | grep -i PROGRAM_NAME 

Example : Check which ports SSH is listening on


samurai@samurai:~$ sudo /bin/netstat -plan | grep sshd
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      5257/sshd
tcp        0     52 123.123.123.123:22      124.124.124.124:32846     ESTABLISHED 3551/sshd: samurai
tcp6       0      0 :::22                   :::*                    LISTEN      5257/sshd
unix  3      [ ]         STREAM     CONNECTED     5893     3551/sshd: samurai
unix  2      [ ]         DGRAM                    5849     3551/sshd: samurai

One thought on “HOW TO : Find out which network port a program is using in linux”

Leave a Reply

Your email address will not be published. Required fields are marked *