https://www.cnblogs.com/CEO-H/p/7794306.html
1, lsof -i: port number
2, netstat -tunlp | grep port number
Can view the designated port is occupied which process
Tools / materials
-
linux,windows
-
xshell
Method / Step
-
[Step one] lsof -i
lsof -i to show compliance with the conditions of the process of the case, lsof (list open files) list the current system is a tool to open the file. Root user to execute lsof -i command , as shown below
-
[Step Two] lsof -i: port number
lsof -i: port number, occupation for viewing a port, such as viewing port 22 usage, lsof -i: 22, as in FIG.
-
3
[Step three] netstat -tunlp
netstat -tunlp for displaying relevant circumstances tcp, udp port and processes such as in FIG.
-
4
[Step Four] netstat -tunlp | grep port number
netstat -tunlp | grep port number used to view the process designated port number, view the situation as 22 ports, netstat -tunlp | grep 22, as shown below
https://www.cnblogs.com/Archmage/p/7570716.html
netstat command various parameters as follows:
-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)
To display the current process and all ports on the server service in conjunction with grep to view a specific port and service cases ·
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) netstat -ntpl (TCP type of port) netstat -anp display system port usage