We help IT Professionals succeed at work.

owner of a port

nsum
nsum asked
on
Hi,

When running 'snoop' on Solaris 2.X, ports can be seen from the display. My question is how can I determine what process owns a port.

example output of a snoop:
ATHM-209-219-xxx-36.home.net -> langka       HTTP R port=33362

Ex.
What would be the process ID that uses port=33362

Thanks,

nsum
Comment
Watch Question

jkr
CERTIFIED EXPERT
Top Expert 2012

Commented:
You could use either

netstat -t -p

to display all TCP connections and the PID's that are associated with the ports or

fuser 33362/tcp

to get the PID
CERTIFIED EXPERT

Commented:
lsof
CERTIFIED EXPERT

Commented:
BTW, netstat -p is Linux but not Solaris :-(
jkr
CERTIFIED EXPERT
Top Expert 2012

Commented:
But 'fuser' isn't Linux-only :-)
but the fuser <port>/tcp syntax is linux only.  The answer is 'lsof', just like ahoffman said.
CERTIFIED EXPERT

Commented:
Solaris has fuser too. But like netstat and route, it's one of the nasty programs with it's own syntax on most OSs.

Author

Commented:
To All,

I'm using Sol2.51, Sol2.6 and Sol2.8. I hope there are equivalent commands in these OS platform.

BTW, this is for ahoffmann: what is "lsof" , sorry for the ignorance.

nsum
CERTIFIED EXPERT
Commented:
lsof - list open files
can be found at http://www.sunfreeware.com/

Author

Commented:
ahoffmann,

That is what really I need. LSOF


Thanks

nsum

Explore More ContentExplore courses, solutions, and other research materials related to this topic.