Common commands
lsof -i:端口号
netstat -tunlp|grep 端口号
lsof -i
-
Used to show qualified progress
-
lsof(list open files)
Is a tool to list the open files of the current system
-
lsof
The meaning of each column of output is:COMMAND
: The name of the process or the way the process was startedPID
: Process idUSER
: Process ownerFD
: File descriptorTYPE
:agreement typeDEVICE
:The port numberSIZE/OFF
: OffsetNODE
: Protocol nameNAME
: Node name
netstat -tunlp
-
Used to display
tcp
,udp
port and process related information
-
Command in the
t
,u
,n
,l
,p
have different meanings:-t
Only display related to tcp-u
Only display related to udp-n
Unlimited aliases, can display all the numbers converted to numbers-l
Only display those in the Listen state-p
Display the name of the program that established these connections
netstat -tunlp|grep port number
- Used to view the process of the specified port number
- For example, check the situation of port 22:
netstat -tunlp|grep 22
- For example, check the situation of port 22: