1833017 Members
2370 Online
110048 Solutions
New Discussion

Re: port information

 
Jaideep Krishnan
Frequent Advisor

port information

Hi,

One simple question (good points worth !!)

How can you determine what process is running on the HP-UX system on port "XYZ" ?

Ofcourse "netstat -a" will just tell you whether the port XYZ is in use.

Any ideas? Thanks a lot,

Jaideep
9 REPLIES 9

Re: port information

You need to get lsof :

http://hpux.connect.org.uk/hppd/hpux/Sysadmin/lsof-4.74/

This will give you this info...

HTH

Duncan

I am an HPE Employee
Accept or Kudo
Peter Godron
Honored Contributor

Re: port information

Jaideep,
have a look at :
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=217798

rcpinfo gives some info, but the solution is lsof.
Regards
Ivajlo Yanakiev
Respected Contributor

Re: port information

probably you need only network connection

try this:

lsof -i |more

or

lsof -i |grep XYZ


SAHA
Honored Contributor

Re: port information

lsof is the best command.

Output will be:

snmpdm 960 root 7u inet 0x4361f240 0t0 UDP *:49160 (Idle)
mib2agt 982 root 0u inet 0x43590200 0t0 UDP *:* (Unbound)
dced 1029 root 5u inet 0x43590b00 0t0 TCP *:135 (LISTEN)
dced 1029 root 7u inet 0x43590e00 0t0 UDP *:135 (Idle)


Thanks,
You must PASS failure on way to success !!!
B. Hulst
Trusted Contributor

Re: port information

FYI

lsof = ls open files.

Also available on other OS's.

- Bob
Jaideep Krishnan
Frequent Advisor

Re: port information

Hi, Thanks for your inputs.........

I tried installing this software (root) after downloading it from
http://hpux.connect.org.uk/hppd/hpux/Sysadmin/lsof-4.74/

Below is the outcome........ I repeated the procedure for 4.73 verison as well..... same was the outcome.....

Any inputs on the (below) failure ?

Are there any other sites from where the Depots could be downloaded?

Thanks, Jaideep.

===============================================================

swinstall -s /opt/MY_DOWNLOADS/lsof-4.74-sd-11.11.depot lsof

================================================================
* Summary of Analysis Phase:
* 1 of 1 filesets had no Errors or Warnings.
* The Analysis Phase succeeded.


* Beginning the Install Execution Phase.
* Filesets: 1
* Files: 4
* Kbytes: 224
* Installing fileset "lsof.lsof-RUN,r=4.74" (1 of 1).
ERROR: Unknown owner and/or group for file "/usr/local/bin/lsof".
SUID and/or SGID bit was not set.
ERROR: Failed installing fileset "lsof.lsof-RUN,r=4.74". Check the
above output for details.
* Running install clean command /usr/lbin/sw/install_clean.
NOTE: tlinstall is searching filesystem - please be patient
NOTE: Successfully completed

* Beginning the Configure Execution Phase.

* Summary of Execution Phase:
ERROR: Corrupt lsof.lsof-RUN,r=4.74
ERROR: 1 of 1 filesets had Errors.
ERROR: The Execution Phase had errors. See the above output for
details.
Matti_Kurkela
Honored Contributor

Re: port information

I have seen that sort of error before with some software depots of the Porting Archive. It seems the depot has instructions to install the binary with a certain group, but the instructions to actually create the group are executed only after installing the binary.

If this is the case, you could try installing the same depot twice as a workaround: on the first try it goes to "corrupt" state, but on the next try it will succeed because the group was already created.

You could also take the lsof source package and compile it: lsof does not need ANSI-C compiler, the HP-UX default cc (which is used to rebuild the kernel) is sufficient.

The best way to use lsof to identify a process running on network port XYZ would be to run:
lsof -i tcp:XYZ
or
lsof -i udp:XYZ
depending on whether the process is using TCP or UDP protocol.
MK
Jaideep Krishnan
Frequent Advisor

Re: port information

Noticed that when I installed the depot twice, the second installation went through fine.

I am however hitting a core dump when executing the binary (lsof).

Looks like the binary itself is corrupt.
B. Hulst
Trusted Contributor

Re: port information

Hi,

The binary format can be checked, if it actually is for HPUX, with file.

file lsof

Will give you output of what type of binary and some more details.

Regards,
Bob