View system processes

Dynamic observation process changes
Top
Top commands during execution of the command buttons that can be used
? Display key input commands and information to help
P sorted by cpu utilization
M according to the sort memory usage of
N ordered to pid
T cpu time accumulated by the sort (the TIME +)
K control process
k -> PID to kill: 5383 (pid process) -> Kill PID 5383 with signal [15]: 15 ( signal)
R & lt reassign a nice value to a PID
R & lt -> PID to renice: 3804 (process pid) -> renice PID 3804 to value: -5 (nice value)
q quit

Page Left
<turning to the right

top option
top -d 2 // specify two seconds to update the default is 3 seconds
top -b -n 5> top information /tmp/top.txt // will be five times saved to a file /tmp/top.txt
top - p 13589 // View pid is 13589 corresponding to the state of the process

View the status of the process at some point
ps aux
user USER process
identification number PID process
% CPU CPU usage
% MEM memory usage
VSZ virtual memory usage of
RSS real physical memory usage
TTY console
STAT process state
START open process time
tIME occupied cpu time
the name of the terminal processes COMMAND

PID
1 process 1 (init also called initialization process) 1 process is the parent of other processes other process is the child process 1 process

pstree 查看进程树
pstree -u 查看进程显示用户
pstree -p 显示进程的pid
pstree -a 显示参数

STAT state
R (running) operation status (cpu being processed)
S (Sleeping) sleep hibernation (temporarily not running, backstage hanging by)
the Z-(Zombie) zombie zombie zombie state see the progress status is not normal quit killing
T (stopped) state suspended pending status (not occupied cpu)

pstree | grep qstar filtering keywords

-elf PS
F.
state S STAT process
UID of process
identification number PID process
PPID parent
utilization of cpu C
higher priority PRI process is performed cpu priority, the smaller the numerical value of the priority value of the priority low
higher NI kindly value (-20 to 19) priority values lower the value of
ADDR SZ WCHAN are memory-related
open the program STIME time
TTY run on which terminal
tIME occupied cpu time
the name on the terminal CMD process

Priority modification process
renice nice value of a process of adjustment pid // Nice
1. open qstardict
2.PS -elf | grep qstard
0 S root 3680 1 0 80 0 - 138 685 poll_s 11:17 00:00:00 qstardict?
S root 3689 3229 0 0 80 0 - 25814 pipe_w 11:18 PTS / 0 00:00:00 grep Qstar
3.renice -10 3680
3680: Old priority 0, new new priority -10
4.ps -elf | grep Qstar
0 S 70 0 -10 3680. 1 the root -? 11:17 00:00:00 157 666 poll_s qstardict
0 S the root 80 0 0 3714 3229 - 25814 pipe_w 11:20 PTS / 0 00:00:00 grep Qstar

Specify the nice value when the program opened
a nice -nice value of the process name
nice --15 qstardict be nice specified as -15

Control process
kill
to view the list of signals
kill the -l
1 reload the program HUP
2 Ctrl c Traps INT
15 normal exit TERM
9 forced to kill KILL
19 suspended process STOP
18 activation process CONT

杀死进程
    kill -signal pid
    kill  -15  3804
                -15默认的可以不写
    kill -9 3804 强制杀死
    
暂停进程
    kill -19 3804 
    kill -stop 3804   //可是使用单词代替
    
激活进程
    kill -18 3804   
    kill -cont 3804   

pkill
in accordance with the process name of the process control
pkill - Signal Process name
pkill -9 qstardict

按用户控制进程
pkill -信号 -u 用户名
pkill -9 -u jim

按终端控制进程
pkill -信号 -t 终端名
pkill -9 -t pts/4

查看终端名
tty

killall
to kill all processes related keywords and ssh service
killall -9 keyword

Guess you like

Origin blog.csdn.net/weixin_45177186/article/details/91040788