LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 07-21-2016, 06:41 PM   #1
redhatwannabe
Member
 
Registered: Dec 2008
Posts: 83

Rep: Reputation: 15
What's the option to show the full path of the program listening to a certain port


Dear all,

What's the option to show the full path of the program listening to a certain port

Code:
[oracle@milano ~]$ netstat -nlp | grep :3938
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:3938                0.0.0.0:*                   LISTEN      25075/emagent
while the above is good, I like to know the full path of emagent, is there a option to find out?

thanks in advance!
 
Old 07-21-2016, 09:58 PM   #2
jayjwa
Member
 
Registered: Jul 2003
Location: NY
Distribution: Slackware, Termux
Posts: 765

Rep: Reputation: 240Reputation: 240Reputation: 240
I don't think there's a full path command, to my knowlege, but you can see the program when run as root with "-p", eg.: "netstat -a -p", "ss -a -p", or even "lsof -i". Those will show the PID, and once you have that, you can see the command line via "cat /proc/PID/cmdline" which is usually (always?) the full path.
 
1 members found this post helpful.
Old 07-21-2016, 11:41 PM   #3
jamison20000e
Senior Member
 
Registered: Nov 2005
Location: ...uncanny valley... infinity\1975; (randomly born:) Milwaukee, WI, US( + travel,) Earth&Mars (I wish,) END BORDER$!◣◢┌∩┐ Fe26-E,e...
Distribution: any GPL that work on freest-HW; has been KDE, CLI, Novena-SBC but open.. http://goo.gl/NqgqJx &c ;-)
Posts: 4,888
Blog Entries: 2

Rep: Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567
Wireshark?
 
Old 08-06-2016, 10:29 AM   #4
jnihil
Member
 
Registered: Dec 2012
Location: inside the matrix
Distribution: Debian, Xubuntu, Gentoo, Antergos
Posts: 90

Rep: Reputation: 27
You can use
Code:
ps -cf PID
 
Old 08-06-2016, 04:25 PM   #5
Doug G
Member
 
Registered: Jul 2013
Posts: 749

Rep: Reputation: Disabled
You can also use lsof -i :<port> to quickly find PID's using that port.
 
1 members found this post helpful.
Old 08-06-2016, 06:04 PM   #6
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,774

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
Once you have the PID, "ls -l /proc/{PID}/exe" will show the full path to the executable regardless of what that process might have done to its argv[] array.
 
  


Reply

Tags
netstat


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
NFS export insecure option - can port snooping show reason to use? zLinux12 Linux - Newbie 5 10-07-2013 09:40 AM
Tomcat6 stops listening on port 80 when i change from port 8080 to port 80 trongthect Linux - Server 1 07-27-2012 05:41 PM
What program is listening at port X brazilian_user Linux - Networking 3 04-07-2007 08:06 AM
command to show full directory path cuco76 Linux - Newbie 2 10-12-2006 08:36 PM
configuring terminal so not to show full path harshnoise SUSE / openSUSE 2 02-26-2005 07:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 10:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration