[root@server1 ~]# ps -eaf | grep 20927 apache 20927 1740 0 03:32 ? 00:00:00 /usr/sbin/httpd [root@server1 ~]# lsof -p 20927 -i -a COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME httpd 20927 apache 5u IPv6 11430 0t0 TCP *:http (LISTEN) httpd 20927 apache 7u IPv6 11434 0t0 TCP *:https (LISTEN)
Showing posts with label port. Show all posts
Showing posts with label port. Show all posts
Sunday, February 24, 2013
How to find port opened by a process?
Labels:
How-to series,
Linux,
Linux fundamentals,
lsof,
PID,
port,
process,
Solaris
Thursday, January 12, 2012
How to find a PIDs using a port?
Simple solution: Use lsof :)
The following solution works perfectly on a Linux system. In case of Solaris, lsof has to be installed first because it is not a part of default OS.
The following solution works perfectly on a Linux system. In case of Solaris, lsof has to be installed first because it is not a part of default OS.
[root@linux01 ~]# lsof -w -n -i tcp:22
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
sshd 2410 root 3u IPv4 6134 TCP *:ssh (LISTEN)
sshd 1639 root 3u IPv4 1637600475 TCP 10.20.30.99:ssh->10.20.50.231:35263 (ESTABLISHED)
sshd 9592 root 3u IPv4 3266851044 TCP 10.20.30.99:ssh->10.20.50.231:44621 (ESTABLISHED)
sshd 10119 root 3u IPv4 3006017510 TCP 10.20.30.99:ssh->10.20.50.231:62445 (ESTABLISHED)
sshd 13909 root 3u IPv4 739010581 TCP 10.20.30.99:ssh->10.20.40.88:35215 (ESTABLISHED)
sshd 24696 root 3u IPv4 273846126 TCP 10.20.30.99:ssh->10.20.40.89:39529 (ESTABLISHED)
sshd 24900 root 3u IPv4 352035868 TCP 10.20.30.99:ssh->10.20.40.88:59163 (ESTABLISHED)
sshd 25662 root 3u IPv4 982162556 TCP 10.20.30.99:ssh->10.20.40.89:65096 (ESTABLISHED)
sshd 27358 root 3u IPv4 982169152 TCP 10.20.30.99:ssh->10.20.40.89:65097 (ESTABLISHED)
Labels:
How-to series,
Linux fundamentals,
lsof,
PID,
port,
process,
Solaris
Subscribe to:
Posts (Atom)