When you are the Linux administrator or system administrator, you should aware about the process that causing your server network connections. This could be helpful in case of any server level troubleshoot. In Unix-like systems, you can monitor the inbound and outbound network connections using the command openstat. This command line is really very helpful when you are troubleshooting network related issues on your servers. Also, this command is available with many options in order to easier the process, i.e we can use this command to listen the incoming TCP and UDP connections, outgoing TCP and UDP connections, to list all other UNIX connections, etc.

 

Before executing all the below commands, you should ensure that root access of your server, i.e you should log in as a root user to run this commands

Command to listen to all ongoing network connections including TCP, UDP and Unix connections,

netstat -a

The above command will produce the output of all the network connections with its address and state.

Command to listening TCP Ports connections only,

netstat -at

Command to listening UDP Ports connections only,

netstat -au

We can also list the listening ports using this netstats command line, command to list all the listening port is

netstats -l

Command to list all the listening TCP Ports connections only,

netstats -lt

Command to list all the listening UDP Ports connections only,

netstats -lu

Categorized in: