Glam Prestige Journal

Bright entertainment trends with youth appeal.

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?

1

5 Answers

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.

3
netstat -lp
1

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))

In Linux, To find a process running on a port, do below:

lsof -i :<port_number>

example:

lsof -i :8080
1

also if you want to list running processes that are speaking TCP you can use

sudo netstat -tnp sudo to get processes you don't own -t for TCP -n for numeric -p for pid

to get processes speaking UDP replace the -t with a -u

sudo netstat -unp

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy