Linux Process Running on a Port on Linux - chaitanyavangalapudi/devops-scripts GitHub Wiki

Different commands to find the process running on a port:

Before running below commands, make sure utilities are installed.

yum install net-tools lsof psmisc

Run all the commands below as sudo:

lsof -i tcp:8080

[root@localhost ~]# lsof -i tcp:8080 | grep LISTEN COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME java 2194 jenkins 163u IPv6 31864 0t0 TCP *:webcache (LISTEN)

[root@localhost ~]# lsof -i :8080 | grep LISTEN COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME java 2194 jenkins 163u IPv6 31864 0t0 TCP *:webcache (LISTEN)

fuser 8080/tcp

[root@localhost ~]# fuser 8080/tcp 8080/tcp: 2194

netstat -ntulp | grep ":8080"

[root@localhost ~]# netstat -ntulp | grep ":8080" tcp6 0 0 :::8080 :::* LISTEN 2194/java

ss -lptn 'sport = :8080'

[root@localhost ~]# ss -lptn 'sport = :8080' State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 50 :::8080 :::* users:(("java",pid=2194,fd=163))

fuser -v -n tcp 8080

[root@localhost ~]# fuser -v -n tcp 8080 USER PID ACCESS COMMAND 8080/tcp: jenkins 2194 F.... java