- This article is the study notes; compared to the original may be some comments and modifications
- Please indicate the source
See all ports occupancy, and found details of the software's port occupied in the process, and finally the end of the process
Check port usage, the last column is the
PID/Program name
use of command:netstat
the COMMAND:netstat –apn
See more details about the software port occupancy
using the command:ps
,grep
the COMMAND:ps -aux | grep java 或者直接: ps -aux | grep pid
Terminate the occupation of the port of the software process
using the command:kill
COMMANDS:kill -9 [pid] 也可以直接使用如下指令: netstat -anp | grep portno
Use
netstat
the command to view occupancynetstat -ap |grep 8080 //查找tomcat端口是否被占用
other
netstat -tln //表示以数字形式查看正在监听的端口 netstat -ap //查看所有应用占用端口情况
netstat
netstat | [Options] |
---|---|
-a or--all |
Show all connections in the Socket |
-A<网络类型> or--<网络类型> |
The network connection types are listed in the relevant address |
-c or--continuous |
Maintains a list of network status |
-C or--cache |
Show cached information router configuration |
-e or--extend |
Other relevant information display network |
-F or--fib |
Display the FIB |
-g or--groups |
Multi-function display broadcast group members list |
-h or--help |
Online Help |
-i or--interfaces |
Display network interface information form |
-l or--listening |
The display monitor server Socket |
-M or--masquerade |
Cloaked network connection |
-n or--numeric |
Ip address directly, without passing through the domain name server |
-N Or --netlink or--symbolic |
Symbolic names are shown connected to network hardware peripheral devices |
-o or--timers |
Display Timer |
-p or--programs |
Display program identifier and the program name being used Socket |
-r or--route |
Display Routing Table |
-s or--statistice |
Statistics show networking information |
-t or--tcp |
Display the connection status of TCP transport protocol |
-u or--udp |
Show connection status UDP transport protocol |
-v or--verbose |
Display during execution of instructions |
-V or--version |
Displays version information |
-w or--raw |
Display the connection status of RAW Transfer Protocol |
-x or--unix |
And the effect of this parameter specifies the same "-A unix" parameter |
--ip or--inet |
And the effect of this parameter specifies the same "-A inet" parameter |