1836585 Members
2429 Online
110102 Solutions
New Discussion

Re: Port Status

 
William Richard
Occasional Contributor

Port Status

How do you find the status of a port on an HP 9000 b.10.20 U ?

Such as port.status port 184

Any input would be greatly appreciated

Regards,
Will
5 REPLIES 5
Steve Steel
Honored Contributor

Re: Port Status

Hi


try netstat -a


Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Kaare Andersen
New Member

Re: Port Status

Hi,

my suggestion try:

netstat -a|grep 184

because the list from 'netstat -a' can be pretty long.

Best regards,
Kan
U.SivaKumar_2
Honored Contributor

Re: Port Status

Hi,

Port numbers are substituted with service names from /etc/services when you give netstat -a command. Therefore grep 184 will not work.

#netstat -an | grep 184

Will give the proper output

regards,

U.SivaKumar
Innovations are made when conventions are broken
Ralph Grothe
Honored Contributor

Re: Port Status

Hi Will,

like the others already have replied, netstat is the first tool of choice.

Just some minute supplement,
you can further narrow the dump by specifying if the local or remote port is meant you are interested in.

If it is a local server then you'd go for the 4th column

e.g.

netstat -an|awk '$4~/\.184$/'

or a remote listening socket

netstat -an|awk '$5~/\.184$/'

If you are only interested in internet sockets then you could narrow the dump by further supplying "-f inet" to netstat.

The sockets' states are displayed in the last column.

Apart from the ubiquitious netstat command the lsof tool has much more to offer, but is not shipped per default with HP-UX

If you compiled lsof from the source yourself or got hold of a binary you could do somethink like

lsof -i tcp:184

This will also list you the processes which use these sockets.

lsof has a myriad of options to show you far more than you ever dared to ask for.
Read the manpage of lsof
Madness, thy name is system administration
Michael Steele_2
Honored Contributor

Re: Port Status

"...netstat -an..." is useful to a degree but as the above posting stated you get more with "...lsof..."

All sockets or ports are open files. This makes it a candidate for the "..list open files..." command, lsof. Use:

lsof -U port
Support Fatherhood - Stop Family Law