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.
netstat is the powerful handy tool to troubleshoot network related issues and following are some of the examples.
To View Only Established Connection
netstat -natu | grep 'ESTABLISHED'
To View, Only Connection is 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 hexadecimal)
Once you have hexadecimal then can execute below to get wich process is holding a port number.
rmsock $address_of_pcb tcpcb
Show the list of network interfaces
I hope this helps you to get familiar with netstat commands. If interested in learning about Linux networking then check out this.