学习地址:
learn netstat
with example.
Netstat
is a command line utility that tells us about all the tcp/udp/unix
socket connections on our system. It provides list of all connections that are currently established or are in waiting state. This tool is extremely useful in identifying the port numbers on which an application is working and we can also make sure if an application is working or not on the port it is supposed to work.
Example
Checking all connections:
1
$ netstat -a
Check all
tcp
connections:1
$ netstat -at
Check all
udp
connections:1
$ netstat -au
Checking all
unix
connections:1
$ nestat -ax
List process id and name (it can be combination with any other
netstat
option):1
$ netast -ap
List all port number without its name (it will perform any reverse lookup & produce output with only numbers.), used to speed up:
1
$ netstat -an
port such as
22
will be resolve asssh
ifn
option is not specify.Print only listen port:
1
$ netstat -l
Print networks stats:
1
$ netstat -s
Print Interfaces stats:
1
$ netstat -i
Display multicast group information:
1
$ netstat -g
Display network routing information:
1
$ netstat -r
To get continuous information:
1
$ netstat -c