Unix & Linux: Kill process running on port 80 (5 Solutions!!)

Unix & Linux: Kill process running on port 80 (5 Solutions!!)

HomeOther ContentUnix & Linux: Kill process running on port 80 (5 Solutions!!)
ChannelPublish DateThumbnail & View CountActions
Channel Avatar Roel Van de Paar2020-08-11 15:37:18 Thumbnail
719 Views
Unix & Linux: Kill process running on port 80

The Question: This is the process I want to kill:
sooorajjj@Treako ~/Desktop/MerkMod $ sudo netstat -tunap | grep :80
tcp6 0 0 :::80 :::* LISTEN 20570/httpd

Solutions: Please watch the whole video to see all solutions, in order of how many people found them helpful

== This solution helped 32 people ==
There are several ways to find which running process is using a port.
Using fuser it will give the PID(s) of the multiple instances associated with
the listening port.
sudo apt-get install psmisc
sudo fuser 80/tcp

80/tcp: 1858 1867 1868 1869 1871
After finding out, you can either stop or kill the process(es).
You can also find the PIDs and more details using lsof
sudo lsof -i tcp:80

COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
nginx 1858 root 6u IPv4 5043 0t0 TCP ruir.mxxx.com:http
(LISTEN)
nginx 1867 www-data 6u IPv4 5043 0t0 TCP ruir.mxxx.com:http
(LISTEN)
nginx 1868 www-data 6u IPv4 5043 0t0 TCP ruir.mxxx.com:http
(LISTEN)
nginx 1869 www-data 6u IPv4 5043 0t0 TCP ruir.mxxx.com:http
(LISTEN)
nginx 1871 www-data 6u IPv4 5043 0t0 TCP ruir.mxxx.com:http
(LISTEN)
To limit to sockets that listen on port 80 (as opposed to clients that connect
to port 80):
sudo lsof -i tcp:80 -s tcp:listen
To kill them automatically:
sudo lsof -t -i tcp:80 -s tcp:listen | sudo xargs kill

There is a simple way to do this. First check which process is using port 80 by
https://en.wikipedia.org/wiki/Netstat:
netstat -ntl | grep 80
Now you got the process name and kill the process with the https://
en.wikipedia.org/wiki/Killall command:
killall -9 process name

== This solution helped 7 people ==
Here is a oneliner that shows the command to run :
echo kill $(sudo netstat -anp | awk ‘/ LISTEN / {if($4 ~ /”:80$/”) { gsub
(/”/.*/

Please take the opportunity to connect and share this video with your friends and family if you find it useful.