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
2)To list all tcp ports we use below command:
$ netstat –at | more
3)To list all udp ports we use below command:
$ netstat –au | more
4)To list sockets which are in listen to state we use below commands:
$ netstat –l | more
$ netstat –lt | more :: listing all tcp ports
$ netstat –lu | more :: listing all udp ports
5)To show the statistics for each protocol we use below commands:
$ netstat –s
$ netstat –st :: listing all tcp ports
$ netstat –su :: listing all udp ports
6)To display PID and program names in netstat output we use below commands:
$ netstat –lp
$ netstat –tp :: listing all tcp ports
$ netstat –lup :: listing all udp ports
7)To print netstat information continuously we use below commands:
$ 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
9)To display the kernel routing information we use below command:
$ 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 –ie
12)To show the list of all UNIX listening ports we use below command:
$ netstat –lx
13)To show the list of promiscuous Mode we use below command:
$ netstat –ac 5 | grep tcp
14)To show the list of IPV4 and IPV6 we use below commands:
$ netstat –g
15)To show the list Raw Network Statistics we use below commands:
$ netstat –statistics –raw
We hope that the above article was beneficial to you if you liked it please give us a thumbs up.
Technical Support,