How to check which program use the port 80 on Ubuntu

It is a general command to check which program is using port 80. And also known the PID of this process. Then to force stop it and release the port 80 to other program.


root@ubuntu:~# lsof -i:80
COMMAND   PID     USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
apache2  1314     root    4u  IPv6   9663      0t0  TCP *:http (LISTEN)
apache2  2582 www-data    4u  IPv6   9663      0t0  TCP *:http (LISTEN)
apache2  4464 www-data    4u  IPv6   9663      0t0  TCP *:http (LISTEN)
apache2  9980 www-data    4u  IPv6   9663      0t0  TCP *:http (LISTEN)
apache2  9982 www-data    4u  IPv6   9663      0t0  TCP *:http (LISTEN)
apache2 10120 www-data    4u  IPv6   9663      0t0  TCP *:http (LISTEN)
apache2 10147 www-data    4u  IPv6   9663      0t0  TCP *:http (LISTEN)
apache2 10282 www-data    4u  IPv6   9663      0t0  TCP *:http (LISTEN)
apache2 10283 www-data    4u  IPv6   9663      0t0  TCP *:http (LISTEN)
apache2 10543 www-data    4u  IPv6   9663      0t0  TCP *:http (LISTEN)
apache2 10544 www-data    4u  IPv6   9663      0t0  TCP *:http (LISTEN)

 

2014-07-29_143727

To get more details of how to use command lsof, enter lsof –help to get the help.