How to determine the port-application mapping/bind on Linux CentOS/RedHat?
netstat -tulpn ( Active Internet Connections, only servers )
Example output:
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:43558 0.0.0.0:* LISTEN –
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN –
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN –
tcp 0 0 0.0.0.0:36593 0.0.0.0:* LISTEN 14483/java
tcp 0 0 0.0.0.0:48146 0.0.0.0:* LISTEN 14483/java
tcp 0 0 0.0.0.0:6002 0.0.0.0:* LISTEN 14483/java
/proc/$pid/ file system – Under Linux /proc includes a directory for each running process (including kernel processes) at /proc/PID, containing information about that process, notably including the processes name that opened port.
In this case we can use the command:
ls -l /proc/14483/java
Output:
lrwxrwxrwx 1 esadmin esadmin 0 Apr 26 16:01 /proc/14483/exe -> /opt/IBM/es/_jvm/jre/bin/java
You can also use the lsof command:
lsof -i :80
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
httpd 18940 root 3u IPv4 94051 0t0 TCP *:http (LISTEN)
httpd 18947 apache 3u IPv4 94051 0t0 TCP *:http (LISTEN)
httpd 19072 apache 3u IPv4 94051 0t0 TCP *:http (LISTEN)
Views: 268