Looks for processes that listen to specified ports in Linux

Look for the process of listening to the specified port, for the system administrator, is an eternal topic. Historically, Linux distribution can use a third party lsof.

lsof is a command meaning “list open files”, which is used in many Unix-like systems to report a list of all open files and the processes that opened them. This open source utility was developed and supported by Victor A. Abell, the retired Associate Director of the Purdue University Computing Center. It works in and supports several Unix flavors

ddos@ubuntu:~$ sudo netstat -na -p tcp | grep LISTEN

Now, you want to know which is listening on “tcp6 0 0 :::80 :::* LISTEN 3906/apache2

sudo lsof -ni tcp:80
sudo ps -opid,ppid,uid,addr,fname,comm,args -p 5044

sudo lsof -n -p 5044| grep TCP