Home » Questions » Computers [ Ask a new question ]

Finding the process that is using a certain port in Linux

Finding the process that is using a certain port in Linux

I'd like to be able to find out which process is currently using a certain port in Linux. Is there any way to do this?

Asked by: Guest | Views: 286
Total answers/comments: 2
Guest [Entry]

"You have a couple of options:

lsof -i tcp:80

will give you the list of processes using tcp port 80.

Alternatively,

sudo netstat -nlp

will give you all open network connections."
Guest [Entry]

"I am using ""CentOS 7 minimal"" which has nor netstat neither lsof. But a lot of linux distributions have the socket statistics command (i.e. ss).

Here is an example of execution:

# ss -tanp | grep 6379
LISTEN 0 128 127.0.0.1:6379 *:* users:((""redis-server"",pid=2531,fd=4))"