Find Which Process Is Holding A Port Open Without lsof in AIX

Finding the process which is holding a port open in AIX can a pain if your company hasn’t enabled lsof.

Here is a workaround found through a LOT of messing around.

1) Find the tcp control block being used by the process:

# netstat -Aan |grep port_number

2) Try to remove that socket using rmsock

# rmsock tcp_control_block_reference tcpcb

3) Run ps -ef on the process to find out which process is holding the port open

Sample output:

# netstat -Aan |grep 7001
f1000e000373cbb8 tcp4       0      0  *.7001                *.*                   LISTEN
# rmsock f1000e000373cbb8 tcpcb
The socket 0xf1000e000373c808 is being held by proccess 12255362 (java).
# ps -ef |grep 12255362

# ps -ef |grep 12255362
username 12255362 19529980   4   26 Feb      – 17:25 /opt/IBM/mft/sfg/jdk/bin/java