Operating System - HP-UX
1848179 Members
4256 Online
104022 Solutions
New Discussion

Re: Identifying Port Usage

 
SOLVED
Go to solution
Chuck Ciesinski
Honored Contributor

Identifying Port Usage

Is there a best method for identifying what application is running on s specific port? I would like to identify what is running on say port 8080 or 2026, etc.

Thanks in advance,

Chuck
"Show me the $$$$$"
6 REPLIES 6
Dave Olker
Neighborhood Moderator
Solution

Re: Identifying Port Usage

Hi Chuck,

I've always found lsof to be the best way to map applications to port numbers.

Regards,

Dave


I work at HPE
HPE Support Center offers support for your HPE services and products when and how you need it. Get started with HPE Support Center today.
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]
Accept or Kudo
A. Clay Stephenson
Acclaimed Contributor

Re: Identifying Port Usage

Netstat -an can be of some help but, by far, the most direct mapping of port usage to a process is lsof. You can get lsof from any of the HP-UX Porting Centre's and is one of those utilities that no UNIX box should be without.
If it ain't broke, I can fix that.
Jeff Schussele
Honored Contributor

Re: Identifying Port Usage

Hi Chuck,

You can also go to iana.org to see what ports software *should* be using. It's no guarantee but it can get you started - here:

http://www.iana.org/assignments/port-numbers

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Ralph Grothe
Honored Contributor

Re: Identifying Port Usage

I am not sure if things have changed by know
but I felt inclined to add that I didn't find the prebuilt binaries of lsof from the porting centre of much use since they used to be 32bit builds which crashed while executing them on our 64bit OSes.
I had to compile a 64bit binary myself from the sources that could be used on our 11.11 v1 boxes.
But compilation was straight-froward.
lsof is defenitely the best tool for questions like yours.
As an aside I would like to mention that the GNU netstat command as can be found on all Linux distros has many more features than the vanilla netstat of the venerable Unices.
One such feature is the -p switch to also identify the processes that use the sockets.
You could for instance issue

netstat -tnp

Maybe you could try to compile GNU netstat for HP-UX as well?
Madness, thy name is system administration
Victor Fridyev
Honored Contributor

Re: Identifying Port Usage

Hi,

Run
#> lsof +M |grep -e 8080 -e 2026
and you will see the process which running on the portd

HTH
Entities are not to be multiplied beyond necessity - RTFM
Sandman!
Honored Contributor

Re: Identifying Port Usage

# lsof -i@hostname:8080 -i@hostname:2026

if you don't specify the hostname it will show all hosts, remote and local, that are running apps on the supplied ports (8080 or 2026).