Process Management
Similar to the windows system ctrl + shift + esc process management
-
Meaning the state reporting process ps process status process state kill killall kill
-
-a display all processes
-
-u user specifies the details of the process
-
-x usually used together with a detailed list of information
-
-r running processes
-
sudo PS -a | More -5 # Show all the process paging display per page 5
sudo PS -u root | More 20 sudo PS -u root | grep kworker root @ Ubuntu: ~ # PS -aux | grep nginx # Key common ★★★★★ root 114 640 0.0 0.0 28352 868 Ss? 00:26 0:00 nginx: Master Process / usr / local / nginx / sbin / nginx -c / usr / local / nginx / conf / nginx .conf the WWW 114 641 0.0 0.8 50024 25472 S? 00:26 0:00 nginx: Process worker
the WWW 114 642 0.0 0.8 50024 25472 S? 00:26 0:00 nginx: Process worker
root 115 424 0.0 0.0 15972 972 PTS / 23 S + 00:42 0:00 grep --color = Auto nginx
# above indicate that the service starts # # user process ID #cpu usage and memory usage # # # virtual memory control terminal memory-resident amount # process? representation is not a terminal into the de # R-ready status of the process can be interrupted hibernation S T pause # process time process name # # start time has performed the WWW 114 641 0.0 0.8 50024 25472? S 00:26
Nginx 0:00: Process worker the root @ Ubuntu: ~ # STOP-Service Nginx the root @ Ubuntu: ~ # PS -aux | grep Nginx the root 115 466 0.0 0.0 15972 1084 PTS / 23 is S + 00:43 0:00 grep - -color = Auto nginx daemon # service stops below show # kill the process the kill 1.kill process ID # kill the specified process 2.kill -9 process ID # force kill process developed killall -TERM process name, for example killall -TERM nginx kill all processes associated with nginx
-
netstat to see whether a particular service launched
netstat -ntlp | grep port number or service name
, for example:
root @ Ubuntu: ~ # netstat -ntlp | grep 22
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1051 / sshd
tcp6 0 0 ::: 22 :: : * LISTEN 1051 / sshd
-
top
Like windows ctrl + shift + esc q quit
The number of users to log time minutes # # # the current time server system running load system # 1 minute 5 minutes 15 minutes load average mononuclear these will not exceed 1
Top - 00:55:45 up 8:40, 5 the Users, the Load Average: 0.00, 0.00, 0.02
# number of tasks running sleep stop the tasks: 261 Total,. 1 running, 191 Sleeping, 0 stopped, 0 zomb % Cpu (S): 0.0 US, 0.0 SY, 0.0 Ni, 100.0 ID, 0.0 WA, 0.0 hi, 0. total memory free to use the user cache KiB Mem: 3014208 total, 646580 free , 1350112 used, 1017516 b swap KiB swap: 998396 total, 998396 free , 0 used 1326144 a. a more convenient tool apt install htop -get htop q quit