

netstat 命令用于显示各种网络相关信息,比如网络连接,路由表,接口状态 (Interface Statistics),masquerade 连接,多播成员 Multicast Memberships等等

列几个比较常用的

netstat -tunlp这里我们简单科普一下网络连接状态State的含义 :
# netstat -a | more : To show both listening and
non-listening sockets.
# netstat -at : To list all tcp ports.# netstat -au : To list all udp ports.# netstat -l : To list only the listening ports.# netstat -lt : To list only the listening tcp ports.# netstat -lu : To list only the listening udp ports.# netstat -lx : To list only the listening UNIX ports# netstat -s : To list the statistics for all ports.# netstat -st(TCP) : To list the statistics for TCP ports.
# netstat -su(UDP) : List the statistics for UDP ports.# netstat -pt : To display the PID and program names.# netstat -c : To print the netstat information continuously.# netstat -r : To get the kernel routing information.# netstat -ap | grep ssh : To get the port
on which a program is running.# netstat -an | grep ':80' : To get the process
which is using the given port.