I work on HPUX hosts. The sad thing about HPUX is that it has very few of the oh-so-wonderful GNU tools that Linux and other *NIX OSes have.
Last night I tried to figure out which service has a particular port open on a host. I searched the internet high and low for something specific for HPUX. All I could find on all the HP forums, etc was that the best thing to do is install a little app name lsof that is normally associated with Linux. lsof will give you the Process ID of whichever port you give it. But alas, installing open source software is not an option.
But wait…if lsof most likely queries a system library to figure this out, why can’t I? My workaround is not as elegant, but it gave me enough information to find and kill the culprit:
perl -e ‘$i=getservbyport(”22″,”tcp”);print “$i\n”;’
Of course this is just an example, we all know tcp port 22 is ssh. Next on the list, find the pid…











