netstat (network statistics) is a command-line tool that displays network connections (both incoming and outgoing), routing tables, and a number of network interface statistics. It is available on Unix, Unix-like, and Windows NT-based operating systems.
To View Only Established Connection
netstat -natu | grep 'ESTABLISHED'
To View Only Connection are in Listen Status
netstat -an | grep 'LISTEN'
To View Port Number used by PID
netstat -anlp | grep $PID
Show statistics for all protocols
Show kernel routing information
Show which process using particular port
netstat -anlp | grep portnumber
AIX : # netstat -Aan | grep portnumber (This will display address of Protocol Control Block in hexdecimal)
Once you have hexdecimal then can execute below to get wich process is holding port number.
rmsock $address_of_pcb tcpcb
Show the list of network interfaces
I hope this helps you to get familiar with netstat commands and help at your work. Like it? Share it!