There have been a lot of threads about how to find processes that are using a specific port on an AIX server. After long hours of research and reading countless "you can't do that" responses, I finally found the answer.
YES IT CAN BE DONE! YES ITS EASY. NO, I DON'T KNOW WHY NO ONE GETS THIS ANSWER WHEN THEY ASK.
So here it is:
Recently, we had an issue with a port conflict on our server. Something was LISTENING on port 14248. You can find whether a port is in use by using the netstat command and grepping for the port number in question.
/>netstat -an | grep 14248
tcp 0 0 *.14248 *.* LISTEN
However, this is not enough to tell you what process is using the port, only that its being used. You can, however, add the -A argument to the netstat command and then use that output as an argument to the rmsock command to find the PID of the process using the port.
# netstat -Aan |grep 14248
f10007000864ebb0 tcp 0 0 *.14248 *.* LISTEN
# rmsock f10007000864ebb0 tcpcb
The socket 0x864e808 is being held by proccess 143640 (java).
# ps -ef |grep 143640
root 143640 127270 0 May 15 - 3:06 /var/opt/tivoli/ep/_jvm/jre/bin/java
Walla!! We see that the Tivoli java process is using port 14248.
Enjoy your new found power to find what process is using a port on your AIX server!
Cheers,
Troy Morton
Senior Technical Analyst
Hospital Sisters Health Systems