Netstat is one of the most used commands by   system admins to checks the network and protocols  related to his machine. you can also list out all your UDP or TCP  connections (Sockets),

Lets give Some Examples of netstat . you can also  type netstat –help or man netstat to  see more options about the netstat usage.


What  are the netstat top 10 commands  ?

1- List all Connections  netstat -a

The command  shows all   connection from all protocols and sockets.  but this  command  still now  filtered, you see too  much  connection



2-Show    TCP/UDP  connection   

2-1-Show  all  TCP connections : 


2-2-Show all UDP Connections 


As  you see  above netstat  is trying  to get  DNS lookup (Hostnames) of remote  servers, disabling  this option speeding up the  answer of  netstat . lets give this example   of  tcp   connection  netstat  -atn   (a= all   t= tcp   n =  numeric  ( dont resolve names) 


3-List  out  all  Listening connections ( Daemons)

in this command  you see all ports open  to receive connection from  other  machines

Like sshd  or  httpd  or samba or DNS  …

netstat  -atp  ( all – tcp- listening )   you can also replace tcp t with udp  u . or  use them both with tcpudp  (tp)


4-Find PID  and USER  behind  every connection

This is very important to get  the Processes ID and the software ( program  behind)


 if you want to see the Process + the user behind.  use the bellow command  .  please  note  the  Process ID should only run under  root  user.

The e option  is  for  extended  information  (   user and  Inode)


The  option ne in netstat  is  showing UID  user instead  of username 


5-Show netstat output continuously

you   also  use  grep  after  to make some filters 

6-Show statistics 

This  command will show all related  network statics  like total  packets  per protocol

The command  is  netstat  -s


7-Ethernet   interfaces 

you  can use this  command  to   see you Ethernet  Cards   and you IP /network configuration  like ip   broadcast  mask , this command if  good  alternative for ifconfig  command 


8-Display Routing and  gateway 

The Kernel Ip routing Tables will displayed , you can see now your gateway in ur second Column


9-Display  Multicasting  Table 

This Command will Display multicast group membership information for IPv4 and IPv6.


10- All Unix   Listening  Ports 

All  Linux  Listening Ports  displayed  with  netstat -lx



Netstat  is one of  the  most used linux command  by admins  to check  their  networks activities . and  there is many  other Netstat   Linux  commands  to Specify   and filer  other  things .

Please  let us know if you  know any specified  commands or you have  some issues  to get   information from your network


Please enter your comment!
Please enter your name here