Finding the PID of the process using a specific port?

por | 21 enero, 2016

http://unix.stackexchange.com/questions/106561/finding-the-pid-of-the-process-using-a-specific-port
Also you can use lsof utility. Need to be root.
# lsof -i :25

COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME

exim4 2799 Debian-exim 3u IPv4 6645 0t0 TCP localhost:smtp (LISTEN)

exim4 2799 Debian-exim 4u IPv6 6646 0t0 TCP localhost:smtp (LISTEN)
You can use netstat’s -p option. You’re already issuing it, but to get process information, you need to be the superuser:
$ sudo netstat -nlp | grep 80

tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 125004/nginx