Friday, December 28, 2012

Linux command to list out all processes running on a port: lsof

lsof means list open files, which lists all disk files, pipes, network sockets and devices opened by all processes.

lsof -i:80 list out all the processes running on port 80.

 # lsof -i:80 
 
COMMAND   PID     USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME
apache2  2793 www-data    3u  IPv4 2500053      0t0  TCP *:http (LISTEN)
apache2  3298 www-data    3u  IPv4 2500053      0t0  TCP *:http (LISTEN)
apache2  3299 www-data    3u  IPv4 2500053      0t0  TCP *:http (LISTEN)
apache2  3299 www-data   13u  IPv4 2991950      0t0  TCP li252-661.linod
apache2  3304 www-data    3u  IPv4 2500053      0t0  TCP *:http (LISTEN)
apache2  3349 www-data    3u  IPv4 2500053      0t0  TCP *:http (LISTEN)
apache2  3354 www-data    3u  IPv4 2500053      0t0  TCP *:http (LISTEN)
apache2  3355 www-data    3u  IPv4 2500053      0t0  TCP *:http (LISTEN)
apache2  3356 www-data    3u  IPv4 2500053      0t0  TCP *:http (LISTEN)
apache2  3357 www-data    3u  IPv4 2500053      0t0  TCP *:http (LISTEN)
apache2  3360 www-data    3u  IPv4 2500053      0t0  TCP *:http (LISTEN)
apache2 25697     root    3u  IPv4 2500053      0t0  TCP *:http (LISTEN)

No comments:

Post a Comment