Under AIX, how can I get the full path of a program bound to a port

aixlsofnetstatprocesssocket

Under Linux I can use netstat -tulpnw and ps, like so:

# netstat -tulpnw | grep :53
tcp        0      0 127.0.0.1:53                0.0.0.0:*                   LISTEN      1482/named          
udp        0      0 127.0.0.1:53                0.0.0.0:*                               1482/named          

# ps aux | fgrep 1482
named     1482  0.0  1.0  93656 44900 ?        Ssl  Sep06   3:17 /usr/sbin/named -u named
root     20221  0.0  0.0   4144   552 pts/0    R+   21:09   0:00 fgrep --color=auto 1482
# 

How can I get the full path of a program bound to a port when using ksh in AIX 6?

Best Answer

As recommended by IBM: use lsof -i -n and look for port XY. If you want parseable output from lsof, use the -F flag and parse the output with awk.

You can get pre-compiled binaries for AIX V5. I don't know if there are pre-compiled binaries for V6; if there aren't, get the source and compile it.