How to find open ports and PID relation?

[root@client1 ~]# lsof -i
COMMAND     PID    USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
rpcbind    1361     rpc    6u  IPv4   8648      0t0  UDP *:sunrpc
rpcbind    1361     rpc    7u  IPv4   8652      0t0  UDP *:realm-rusd
rpcbind    1361     rpc    8u  IPv4   8653      0t0  TCP *:sunrpc (LISTEN)
rpcbind    1361     rpc    9u  IPv6   8655      0t0  UDP *:sunrpc
rpcbind    1361     rpc   10u  IPv6   8657      0t0  UDP *:realm-rusd
rpcbind    1361     rpc   11u  IPv6   8658      0t0  TCP *:sunrpc (LISTEN)
avahi-dae  1398   avahi   13u  IPv4   8867      0t0  UDP *:mdns
avahi-dae  1398   avahi   14u  IPv4   8868      0t0  UDP *:41861
rpc.statd  1423 rpcuser    5u  IPv4   9169      0t0  UDP *:kerberos_master
rpc.statd  1423 rpcuser    8u  IPv4   9173      0t0  UDP *:56647
rpc.statd  1423 rpcuser    9u  IPv4   9177      0t0  TCP *:44453 (LISTEN)
rpc.statd  1423 rpcuser   10u  IPv6   9181      0t0  UDP *:33861
rpc.statd  1423 rpcuser   11u  IPv6   9185      0t0  TCP *:34178 (LISTEN)
cupsd      1500    root    6u  IPv6   9440      0t0  TCP localhost:ipp (LISTEN)
cupsd      1500    root    7u  IPv4   9441      0t0  TCP localhost:ipp (LISTEN)
cupsd      1500    root    9u  IPv4   9444      0t0  UDP *:ipp
sshd       1619    root    3u  IPv4   9994      0t0  TCP *:ssh (LISTEN)
sshd       1619    root    4u  IPv6   9996      0t0  TCP *:ssh (LISTEN)
master     1699    root   12u  IPv4  10218      0t0  TCP localhost:smtp (LISTEN)
master     1699    root   13u  IPv6  10220      0t0  TCP localhost:smtp (LISTEN)
httpd      1739    root    4u  IPv6  10463      0t0  TCP *:http (LISTEN)
qpidd      1759   qpidd   10u  IPv4  10564      0t0  TCP *:amqp (LISTEN)
sshd      20154    root    3u  IPv4  85260      0t0  TCP client1.unixgeek.com:ssh->192.168.122.1:41754 (ESTABLISHED)
sshd      20154    root    8u  IPv6  85310      0t0  TCP localhost:x11-ssh-offset (LISTEN)
sshd      20154    root    9u  IPv4  85311      0t0  TCP localhost:x11-ssh-offset (LISTEN)
httpd     30172  apache    4u  IPv6  10463      0t0  TCP *:http (LISTEN)
httpd     30173  apache    4u  IPv6  10463      0t0  TCP *:http (LISTEN)
httpd     30174  apache    4u  IPv6  10463      0t0  TCP *:http (LISTEN)
httpd     30175  apache    4u  IPv6  10463      0t0  TCP *:http (LISTEN)
httpd     30176  apache    4u  IPv6  10463      0t0  TCP *:http (LISTEN)
httpd     30177  apache    4u  IPv6  10463      0t0  TCP *:http (LISTEN)
httpd     30178  apache    4u  IPv6  10463      0t0  TCP *:http (LISTEN)
httpd     30179  apache    4u  IPv6  10463      0t0  TCP *:http (LISTEN)
sshd      32503    root    3r  IPv4 104270      0t0  TCP client1.unixgeek.com:ssh->192.168.122.1:44522 (ESTABLISHED)



Posted by Unix Geek at 7:25 PM 0 comments

Email ThisBlogThis!Share to TwitterShare to Facebook

Labels: How-to series, Linux, Linux fundamentals, lsof, PID, process, Solaris

How to find PIDs associated with a specific mount point or directory?

[root@server1 ~]# lsof +D /tmp
COMMAND    PID USER   FD   TYPE             DEVICE SIZE/OFF  NODE NAME
Xorg      2145 root    3u  unix 0xffff880037a00380      0t0 13160 /tmp/.X11-unix/X0
gnome-ses 2231  gdm    8u  unix 0xffff8800d6c05680      0t0 13424 /tmp/.ICE-unix/2231
gnome-ses 2231  gdm   17u  unix 0xffff88007f916080      0t0 13552 /tmp/orbit-gdm/linc-8b7-0-aa1e644ce7ad
gnome-ses 2231  gdm   18u  unix 0xffff88007f917980      0t0 13555 /tmp/orbit-gdm/linc-8b7-0-aa1e644ce7ad
gnome-ses 2231  gdm   23u  unix 0xffff88007f971380      0t0 13800 /tmp/orbit-gdm/linc-8b7-0-aa1e644ce7ad
gconfd-2  2239  gdm   11u  unix 0xffff88007d592380      0t0 13484 /tmp/orbit-gdm/linc-8bf-0-606984a4c9463
gconfd-2  2239  gdm   15u  unix 0xffff88007f916380      0t0 13551 /tmp/orbit-gdm/linc-8bf-0-606984a4c9463
gconfd-2  2239  gdm   17u  unix 0xffff8800d7331c80      0t0 13653 /tmp/orbit-gdm/linc-8bf-0-606984a4c9463
gconfd-2  2239  gdm   19u  unix 0xffff8800d959e680      0t0 13810 /tmp/orbit-gdm/linc-8bf-0-606984a4c9463
gconfd-2  2239  gdm   21u  unix 0xffff880046d18980      0t0 14068 /tmp/orbit-gdm/linc-8bf-0-606984a4c9463
gconfd-2  2239  gdm   23u  unix 0xffff8800468f7080      0t0 14127 /tmp/orbit-gdm/linc-8bf-0-606984a4c9463
at-spi-re 2253  gdm   11u  unix 0xffff88007f937080      0t0 13739 /tmp/orbit-gdm/linc-8cd-0-148cfa3815bdc
at-spi-re 2253  gdm   12u  unix 0xffff88000a128980      0t0 13743 /tmp/orbit-gdm/linc-8cd-0-148cfa3815bdc
at-spi-re 2253  gdm   14u  unix 0xffff8800d95a6680      0t0 13782 /tmp/orbit-gdm/linc-8cd-0-148cfa3815bdc




Posted by Unix Geek at 7:06 PM 0 comments

Email ThisBlogThis!Share to TwitterShare to Facebook

Labels: How-to series, Linux, Linux fundamentals, lsof, PID, process, Solaris

How to find NFS-only process opened by a specific user?

# lsof -N  -u sge  -a
COMMAND     PID USER   FD   TYPE DEVICE    SIZE     NODE NAME
sge_execd  5251  sge  cwd    DIR   0,29    4096  4368270 /mtpt/nfstmp6/eda_spool/server1 (10.20.30.102:/vol/nfstmp6)
sge_execd  5251  sge  txt    REG   0,28 1917054    99454 /mtpt/grid/sge/sge-6.2u5/bin/lx24-amd64/sge_execd (10.20.30.72:/vol/grid)
sge_execd  5251  sge  mem    REG   0,28    8093  1716583 /mtpt/grid/sge/sge-6.2u5/lib/lx24-amd64/libcore.so (10.20.30.72:/vol/grid)
sge_sheph  6220  sge  cwd    DIR   0,29    4096  4520407 /mtpt/nfstmp6/eda_spool/server1/active_jobs/2050265.1 (10.20.30.102:/vol/nfstmp6)
sge_sheph  6220  sge  txt    REG   0,28 3002442    99445 /mtpt/grid/sge/sge-6.2u5/bin/lx24-amd64/sge_shepherd (10.20.30.72:/vol/grid)
sge_sheph  6220  sge    3u   REG   0,29    5454  4520411 /mtpt/nfstmp6/eda_spool/server1/active_jobs/2050265.1/trace (10.20.30.102:/vol/nfstmp6)
sge_sheph  8064  sge  cwd    DIR   0,29    4096 11745026 /mtpt/nfstmp6/eda_spool/server1/active_jobs/1963625.1 (10.20.30.102:/vol/nfstmp6)
sge_sheph  8064  sge  txt    REG   0,28 3002442    99445 /mtpt/grid/sge/sge-6.2u5/bin/lx24-amd64/sge_shepherd (10.20.30.72:/vol/grid)
sge_sheph  8064  sge    3u   REG   0,29    5490 11267154 /mtpt/nfstmp6/eda_spool/server1/active_jobs/1963625.1/trace (10.20.30.102:/vol/nfstmp6)
sge_sheph 11956  sge  cwd    DIR   0,29    4096  8754269 /mtpt/nfstmp6/eda_spool/server1/active_jobs/1217293.1 (10.20.30.102:/vol/nfstmp6)
sge_sheph 11956  sge  txt    REG   0,28 3002442    99445 /mtpt/grid/sge/sge-6.2u5/bin/lx24-amd64/sge_shepherd (10.20.30.72:/vol/grid)
sge_sheph 11956  sge    3u   REG   0,29    3880 13004799 /mtpt/nfstmp6/eda_spool/server1/active_jobs/1217293.1/trace (10.20.30.102:/vol/nfstmp6)
sge_sheph 27134  sge  cwd    DIR   0,29    4096  2680503 /mtpt/nfstmp6/eda_spool/server1/active_jobs/546332.1 (10.20.30.102:/vol/nfstmp6)
sge_sheph 27134  sge  txt    REG   0,28 3002442    99445 /mtpt/grid/sge/sge-6.2u5/bin/lx24-amd64/sge_shepherd (10.20.30.72:/vol/grid)
sge_sheph 27134  sge    3u   REG   0,29    4008  2680507 /mtpt/nfstmp6/eda_spool/server1/active_jobs/546332.1/trace (10.20.30.102:/vol/nfstmp6)




Posted by Unix Geek at 6:54 PM 0 comments

Email ThisBlogThis!Share to TwitterShare to Facebook

Labels: How-to series, Linux, Linux fundamentals, lsof, nfs, PID, process, Solaris

How to find processes or PID associated with an open PORT?

[root@server1 ~]# lsof -i :80
COMMAND   PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
httpd    1740   root    5u  IPv6  11430      0t0  TCP *:http (LISTEN)
httpd   20923 apache    5u  IPv6  11430      0t0  TCP *:http (LISTEN)
httpd   20924 apache    5u  IPv6  11430      0t0  TCP *:http (LISTEN)
httpd   20925 apache    5u  IPv6  11430      0t0  TCP *:http (LISTEN)
httpd   20926 apache    5u  IPv6  11430      0t0  TCP *:http (LISTEN)
httpd   20927 apache    5u  IPv6  11430      0t0  TCP *:http (LISTEN)
httpd   20928 apache    5u  IPv6  11430      0t0  TCP *:http (LISTEN)
httpd   20929 apache    5u  IPv6  11430      0t0  TCP *:http (LISTEN)
httpd   20930 apache    5u  IPv6  11430      0t0  TCP *:http (LISTEN)
httpd   20931 apache    5u  IPv6  11430      0t0  TCP *:http (LISTEN)

[root@server1 ~]# lsof -i :22
COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
sshd     1129 root    3u  IPv4 609767      0t0  TCP 10.20.30.11:ssh->10.20.30.230:54074 (ESTABLISHED)
sshd     1207 root    3u  IPv4 610131      0t0  TCP 10.20.30.11:ssh->10.20.30.230:54077 (ESTABLISHED)
sshd     1629 root    3u  IPv4  10946      0t0  TCP *:ssh (LISTEN)
sshd     1629 root    4u  IPv6  10948      0t0  TCP *:ssh (LISTEN)
sshd     6352 root    3u  IPv4 621398      0t0  TCP 10.20.30.11:ssh->10.20.30.230:54319 (ESTABLISHED)
ssh      8905 root    3u  IPv4 652131      0t0  TCP 192.168.122.1:41754->client1:ssh (ESTABLISHED)
sshd    21430 root    3r  IPv4 675462      0t0  TCP 10.20.30.11:ssh->10.84.64.173:52323 (ESTABLISHED)
sshd    30917 root    3r  IPv4 754268      0t0  TCP 10.20.30.11:ssh->10.20.30.230:55741 (ESTABLISHED)

[root@server1 ~]# lsof -i :80 -t
1740
20923
20924
20925
20926
20927
20928
20929
20930
20931


Comments

Popular posts from this blog

BMCs and the IPMI Protocol

Logical Domains Reference Manual

Understanding How ZFS Calculates Used Space