May 2, 2014

Which process on AIX has a specific TCP-port open?

Attempting to start a process, but the port is already opened by some
other process.

So the next question is: Which process has opened that port?

On Linux: 

netstat -anp | grep :22

On solaris:

The pcp-Script, which interrogates the /proc filesystem.
pfiles listens the open files/ports by process-ID. 

bash-3.00# ./pcp.sh -p 22
PID     Process Name and Port
_________________________________________________________
755     /usr/lib/ssh/sshd       22
sockname: AF_INET6 ::  port: 22
_________________________________________________________
4279    /usr/lib/ssh/sshd       22
sockname: AF_INET6 ::ffff:192.168.1.50  port: 22
_________________________________________________________
4280    /usr/lib/ssh/sshd       22
sockname: AF_INET6 ::ffff:192.168.1.50  port: 22
_________________________________________________________

On AIX

netstat -Aan | grep 22
> netstat -Aan | grep 22 
f10007001354ebb0 tcp4 0 0 *.22 *.* LISTEN 
f100070001c98bb0 tcp4 0 0 *.22 *.* LISTEN 
> rmsock f100070001c98bb0 tcpcb 
The socket 0x1c98808 is being held by proccess 118888 (sshd).