Operating System - HP-UX
1833589 Members
3641 Online
110061 Solutions
New Discussion

** Tracking down a Process using a Port **

 
Michael Gretton
Frequent Advisor

** Tracking down a Process using a Port **

I need to find out which process ID is using a network port (socket). I am trying to start a web service using a port like 8000 and I am being told it is in use. Using netstat -a, i find that is in fact being used but how can I get the PID so I can kill it? Any help would be grateful,

Mike
6 REPLIES 6
John Waller
Esteemed Contributor

Re: ** Tracking down a Process using a Port **

You will probably need to install the lsof command. This can be found at the "Software Porting and Archive Centre for HPUX" and also at tucows.com . Perform a lsof with a -i option to look at tcpip stuff. This will list PID for any open connections it finds
Sridhar Bhaskarla
Honored Contributor

Re: ** Tracking down a Process using a Port **

Micheal,

You need to use lsof to get this information.

Try it from

http://hpux.asknet.de/hppd/hpux/Sysadmin/lsof-4.55/

It's easy,

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Wodisch
Honored Contributor

Re: ** Tracking down a Process using a Port **

Hello Michael,

AFAIK the best answer is "lsof" (list open files" used with the "-i" (internet) option:
lsof -i tcp:21

This will show you all processes using TELNET (i.e. TCP, and port 21).

Get it from the "HP-UX Porting Archives" near you...

HTH,
Wodisch
A. Clay Stephenson
Acclaimed Contributor

Re: ** Tracking down a Process using a Port **

Hi Micheal:

lsof is definitely the tool for this job. Be aware that if you are running 64-bit 11x that you must download the source and compile it as the only binary versions available are 32-bit and will not execute in 64-bit land.
If it ain't broke, I can fix that.
michael nowak
New Member

Re: ** Tracking down a Process using a Port **

Hello,
I administer a hpux 11.00 64bit system and tried to compile the lsof-4.55 but got the following output:

Looking for ipis_s with /usr/contrib/bin/q4 ...
!!!ERROR!!! /usr/contrib/bin/q4 failed and produced the following output.
q4: (warning) no modules in the crashdump or no INDEX file
nm: invalid option -- h
Usage: nm [-aABCDglnopPrsuvV] [-t radix] [--radix=radix] [--target=bfdname]
[--debug-syms] [--extern-only] [--print-armap] [--print-file-name]
[--numeric-sort] [--no-sort] [--reverse-sort] [--size-sort]
[--undefined-only] [--portability] [-f {bsd,sysv,posix}]
[--format={bsd,sysv,posix}] [--demangle] [--no-demangle] [--dynamic]
[--defined-only] [--line-numbers]
[--version] [--help]
[file...]
nm: supported targets: som srec symbolsrec tekhex binary ihex hpux-core
q4: (error) nm command exited, but not cleanly (status==0x100)
!!ERROR!!
Configure can't use /usr/contrib/bin/q4 to examine the ipis_s
structure. You must do that yourself, report the result in
the HPUX_IPC_S_PATCH environment variable, then repeat the
Configure step. Consult the Configure script's use of
/usr/contrib/bin/q4 and the 00XCONFIG file for information
on ipis_s testing and the setting of HPUX_IPC_S_PATCH.

What is wrong with it?

thx
michael
Michael
harry d brown jr
Honored Contributor

Re: ** Tracking down a Process using a Port **