netstat command parameters:
-t: TCP port specified display
-u: UDP port specified display
-l: listening socket (the so-called socket that enables applications to read and write and send and receive communication protocols (protocol) and program data) display only
-p: display the process identifier and program name, and each socket / port belongs to a program.
-n: Specifies DNS polling display IP (speed up operation)
netstat -ntlp // View all current tcp port *
netstat -ntulp | grep 80 // View all 80 port usage ·
netstat -an | grep 3306 // View all 3306 port usage ·
See which service and port a server above
netstat -lanp
View a service has several ports. For example, to view the mysqld
ps -ef | grep mysqld
View a port number of connections, such as port 3306
netstat -pnt |grep :3306 |wc
View of a port connecting clients such as IP port 3306
netstat -anp |grep 3306
netstat -an view network port
lsof -i: port, use lsof -i: port will be able to see the port to run the specified program, as well as the current connection.
nmap port scan
netstat -nupl (UDP port type)
the netstat -ntpl (the TCP port type)
the netstat -anp display system port usage
forcibly closed port
Kill -9 port number