Check which program using particular port

if port no# is 631 
                                 
sudo lsof –i:631 –n –P  
                                         
 
-n option prevent auto conversion of ip to name .
-P option prevent auto conversion of port number to port name. 
 
COMMAND   PID USER   FD   TYPE  DEVICE  SIZE/OFF  NODE NAME
cupsd         776 root   10u  IPv6   9353       0t0  TCP [::1]:631 (LISTEN)
cupsd         776 root   11u  IPv4   9354       0t0  TCP 127.0.0.1:631 (LISTEN)
cups-brow      953 root    8u  IPv4   9930      0t0  UDP *:631 

If you want a list of all open TCP ports and the programs/processes associated you can type:

$ sudo lsof -i -n -P | grep TCP      
 ~~~~~~~~~~~~~~~~~~~~~~

No comments:

Post a Comment