Netstat command is used to tell different network related information such as network connections, routing tables, masquerade connections, multicast memberships. This article targets the audience which have Linux Based VPS or Linux Based Dedicated Server.

1)To list all ports listening and non-listening we use below command:

$ netstat –a | more

netstat -a

2)To list all tcp ports we use below command:

$ netstat –at | more

netstat -at

3)To list all udp ports we use below command:

$ netstat –au | more

netstat -au

4)To list sockets which are in listen to state we use below commands:

$ netstat –l | more

netstat -l

$ netstat –lt | more :: listing all tcp ports

netstat -lt

$ netstat –lu | more :: listing all udp ports

netstat -lu

5)To show the statistics for each protocol we use below commands:

$ netstat –s

netstat -s

$ netstat –st  :: listing all tcp ports

netstat -st

$ netstat –su  :: listing all udp ports

netstat -su

6)To display PID and program names in netstat output we use below commands:

$ netstat –lp

$ netstat –tp  :: listing all tcp ports

netstat -tp

$ netstat –lup  :: listing all udp ports

7)To print netstat information continuously we use below commands:

$ netstat –c

netstat -c

$ netstat –tc  :: listing all tcp ports

$ netstat –sc  :: listing all udp ports

8)To find the non-supportive address families in your system we use below command:

$ netstat –verbose

netstat --verbose

9)To display the kernel routing information we use below command:

$ netstat –r

netstat -r

10)To find out on which port a program is running we use below commands:

$ netstat –ap | grep ssh

$ netstat –an | grep 80

11)To show the list of network interfaces we use below commands:

$ netstat –i

netstat -i

$ netstat –ie

netstat -ie

12)To show the list of all UNIX listening ports we use below command:

$ netstat –lx

netstat -lx

13)To show the list of promiscuous Mode we use below command:

$ netstat –ac 5 | grep tcp

netstat -ac 5

14)To show the list of IPV4 and IPV6 we use below commands:

$ netstat –g

netstat -g

15)To show the list Raw Network Statistics we use below commands:

$ netstat  –statistics –raw

raw

 

We hope that the above article was beneficial to you if you liked it please give us a thumbs up.

Technical Support,

Stromind.