Linux (ubuntu) check which process uses a port
How to check which process is using a given port number in Linux using netstat command
To see which process is using a certain port we will use netstat command , if not installed , install net-tools :
#for ubuntu/debian users
sudo apt install net-tools
let check which process is using port 80:
sudo netstat -ltnp | grep :27017
the result is :
tcp 0 0 127.0.0.1:27017 0.0.0.0:* LISTEN 2481/mongod
we see that the port 27017 is used by mongod with pid 2481
get some information about the process using ps command
ps -aux | grep 2481
mongodb 2481 0.6 0.4 1519600 100704 ? Ssl 05:44 1:04 /usr/bin/mongod --config /etc/mongod.conf