- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: How can I find the port with reference to PID ...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-25-2010 03:38 AM
тАО10-25-2010 03:38 AM
How can I find the port with reference to PID which is running on the server.
How can I find the port with reference to PID which is running on the server.
For example, assume PID is 1785
And I want to know which port number is mapped for PID 1785
root@chiti # ps -ef | grep ssh
root 1785 1 0 14:23:35 ? 0:00 /usr/lib/ssh/sshd
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-25-2010 03:47 AM
тАО10-25-2010 03:47 AM
Re: How can I find the port with reference to PID which is running on the server.
lsof -p 1785
netstat -nap | grep 1785
Regards,
Goran
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-25-2010 06:20 AM
тАО10-25-2010 06:20 AM
Re: How can I find the port with reference to PID which is running on the server.
i got it with netstat -nap
but, how can figure out from command lsof?
can u explain the output of lsof which mentioned below.
root 9428 1 0 Oct22 ? 00:00:01 /usr/sbin/sshd
# lsof -p 9428
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
sshd 9428 root cwd DIR 104,5 4096 2 /
sshd 9428 root rtd DIR 104,5 4096 2 /
sshd 9428 root txt REG 104,2 409024 598371 /usr/sbin/sshd
sshd 9428 root mem REG 104,5 58683 /lib/libpam.so.0.81.5 (path inode=61307)
sshd 9428 root DEL REG 104,5 58584 /lib/libcrypto.so.0.9.8e.#prelink#.GvMDrd
sshd 9428 root mem REG 104,2 538362 /usr/lib/libnssutil3.so (path inode=543552)
sshd 9428 root mem REG 104,5 58681 /lib/libaudit.so.0.0.0 (path inode=61306)
sshd 9428 root mem REG 104,5 58573 /lib/libcrypt-2.5.so (path inode=58545)
sshd 9428 root mem REG 104,5 58583 /lib/libcom_err.so.2.1 (path inode=61303)
sshd 9428 root mem REG 104,2 538372 /usr/lib/libnspr4.so (path inode=543059)
sshd 9428 root DEL REG 104,2 543629 /usr/lib/libkrb5support.so.0.1.#prelink#.wmZE1l
sshd 9428 root mem REG 104,5 59434 /lib/libnsl-2.5.so (path inode=58529)
sshd 9428 root mem REG 104,5 50848 60754 /lib/libnss_files-2.5.so
sshd 9428 root mem REG 104,5 58576 /lib/libselinux.so.1 (path inode=59371)
sshd 9428 root mem REG 104,5 58543 /lib/libc-2.5.so (path inode=58521)
sshd 9428 root mem REG 104,2 543488 /usr/lib/libplc4.so (path inode=543458)
sshd 9428 root mem REG 104,2 543570 /usr/lib/libplds4.so (path inode=543542)
sshd 9428 root mem REG 104,5 58763 /lib/libpthread-2.5.so (path inode=58549)
sshd 9428 root mem REG 104,2 543683 /usr/lib/libz.so.1.2.3 (path inode=543571)
sshd 9428 root mem REG 104,5 59428 /lib/libdl-2.5.so (path inode=58531)
sshd 9428 root mem REG 104,5 58505 /lib/ld-2.5.so (path inode=58514)
sshd 9428 root mem REG 104,2 543689 /usr/lib/libk5crypto.so.3.1 (path inode=543687)
sshd 9428 root mem REG 104,5 59438 /lib/libutil-2.5.so (path inode=58547)
sshd 9428 root mem REG 104,5 58571 /lib/libwrap.so.0.7.6 (path inode=58512)
sshd 9428 root mem REG 104,2 543690 /usr/lib/libkrb5.so.3.3 (path inode=543767)
sshd 9428 root mem REG 104,5 61295 /lib/libresolv-2.5.so (path inode=58527)
sshd 9428 root mem REG 104,2 543611 /usr/lib/libnss3.so (path inode=543566)
sshd 9428 root mem REG 104,5 58570 /lib/libsepol.so.1 (path inode=58694)
sshd 9428 root DEL REG 104,2 543691 /usr/lib/libgssapi_krb5.so.2.2.#prelink#.A6rImB
sshd 9428 root mem REG 104,5 58577 /lib/libkeyutils-1.2.so (path inode=61302)
sshd 9428 root DEL REG 104,2 542443 /usr/lib/libfipscheck.so.1.1.0.#prelink#.daRjWZ
sshd 9428 root 0u CHR 1,3 1513 /dev/null
sshd 9428 root 1u CHR 1,3 1513 /dev/null
sshd 9428 root 2u CHR 1,3 1513 /dev/null
sshd 9428 root 3u IPv4 176345223 TCP *:ssh (LISTEN)
* I will assign the points in the end.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-25-2010 12:55 PM
тАО10-25-2010 12:55 PM
Re: How can I find the port with reference to PID which is running on the server.
>>sshd 9428 root 3u IPv4 176345223 TCP *:ssh (LISTEN)
This is listening on the 'ssh' port. By default this is port 22, as defined in /etc/services.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-25-2010 12:58 PM
тАО10-25-2010 12:58 PM
Re: How can I find the port with reference to PID which is running on the server.
lsof -p 9428 -P
Then your line with the port info would look like:
sshd 9428 root 3u IPv4 176345223 TCP *:22 (LISTEN)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-26-2010 05:43 AM
тАО10-26-2010 05:43 AM