A view port occupied by the process
1. lsof -i: port number to see a port of occupancy
1 lsof -. I: port number, view a port occupancy
[root @ localhost bin] # lsof -i: 8080
the COMMAND PID the USER FD the TYPE the DEVICE SIZE / OFF NODE NAME
the Java 3511 root 46U IPv6 31351 0t0 TCP * : webcache (LISTEN)
the COMMAND: be famous, as explained above 8080 occupied a java process
PID: ID process, when the process is designated generally kill the process PID
the USER: process owners
2.netstat -ntlp: View all current tcp port
Combined with grep can check the occupancy of a specific port number
netstat -tunlp | grep port number, view the port occupancy
-t, be given the option of tcp
-u, udp given the option of
-n, refused to show the alias can display numbers all converted to digital
-l, lists only in listen (listen) service state
program name -p, show the establishment of related links
[root @ localhost bin] # netstat -tunlp | grep 8080
tcp6 0 0 ::: 8080 ::: * LISTEN 3511 / the Java
These results indicate 8080 port is a process ID of the Java process for the 3511 occupation
[root @ ops01 ~] # -tunlp netstat | grep 3000
tcp6 0 0 ::: 3000 ::: * LISTEN 13298 / node / u01 / WSS
above results indicate 3000 port is a process ID of the node program occupies 13298
Second, according to the program name query process ID
1. ps -ef | grep process name
ps -ef all processes are displayed
UID:进程拥有者
PID:进程ID
PPID:上级父程序的ID
C: CPU 使用的资源百分比
STIME: 系统启动时间
TTY:登入者的终端机位置
TIME:使用掉的 CPU 时间
CMD:所下达的指令名称
例如查询nginx相关进程状态
[root@ops01 ~]# ps -ef|grep nginx