1. Review the process
Another process is generated on the basis of a process, which is a parent-child process;
[Email protected] ~]# Pstree
├─sshd───sshd───bash───pstree
[[Email protected] ~]# PS PID TTY time CMD 2797 pts/0 00:00:00 bash 2874 pts/0 00:00:00 PS
View all processes, x indicates that a child process that does not belong to any terminal is displayed, that is, the TTY is displayed as?, Ps-ef is equivalent to PS aux, different system styles:
[[Email protected] ~]# ps auxuser pid %cpu %mem vsz rss tty (terminal) STAT (status) START TIME COMMANDroot 1 0.2 0.7 53676 7580 ? ss 17:49 0:02 /usr/lib/systemd/systemd -- switched-root --system --deserialize 24root 2 0.0 0.0 0 0 ? s 17:49 0:00 [kthreadd]root 3 0.0 0.0 0 0 ? s 17:49    0:00 [KSOFTIRQD/0]
If you only display values for a few columns, you can use the following command, such as just to display the PID,CPU,MEM:
[[email protected] ~]# ps-ex-o pid,%cpu,%mem--noheader|head 1 0.1 0.7 2 0.0 0.0 3 0.0 0.0 5 0.0 0.0 6 0.0 0.0 7 0.0 0.0 8 0.0 0.0 9 0.0 0.0 10 0.0 0.0 11 0.0 0.0
Dynamic display of the system's process information, using the top command, you can add the time option after the top command, adjust the process display frequency, such as top 1:
Top - 18:22:31 up 33 min, 2 users, load average: 0.00, 0.01, 0.06Tasks: 255 total, 2 running, 253 SLEEPING,   0 STOPPED,   0 ZOMBIE%CPU (s): 0.0 us, 0.3 sy, 0.0 ni, 99.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 stkib mem: 1010860 total, 590376 used, 420484 free, 884 bufferskib swap: 2097148 total, 0 used, 2097148 free. 218452 cached Mem PID user pr ni virt Res shr s %cpu %mem time+ command 3249 root 20 0 123776 1764 1156 R 0.3 0.2 0:00.08 top 1 root 20 0 53676 7580 2524 S 0.0 0.7 0:03.04 systemd
2. View the signal of the process
The commonly used signal is: 9--kills the process, 15--terminates the process; 2--equals CTRL + C; Usage: kill-9 Pid,kill If you do not specify a signal value, the default is 15
[[email protected] ~]# kill -l 1] sighup 2) sigint 3) sigquit 4) sigill 5) sigtrap 6) sigabrt 7) sigbus 8 9) sigkill10) sigusr111) sigsegv12) sigusr213) sigpipe14) SIGTERM16) sigstkflt17) sigchld18) sigcont19) sigstop20) sigtstp21) sigttou23) sigurg24) sigxcpu25) sigxfsz26) sigvtalrm27) SIGWINCH29) sigio30) sigpwr31) sigsys34) sigrtmin35) sigrtmin+136) sigrtmin+338) sigrtmin+439) sigrtmin+540) sigrtmin+641) sigrtmin+742 843) sigrtmin+944) sigrtmin+1045) sigrtmin+1146) sigrtmin+1247) sigrtmin+1449) sigrtmin+1550) sigrtmax-1451) ( sigrtmax-1352) sigrtmax-1253) SIGRTMAX-1154) sigrtmax-1055) &nbSp SIGRTMAX-956) sigrtmax-857) sigrtmax-758) sigrtmax-659) sigrtmax-560) sigrtmax-362) sigrtmax-263) sigrtmax-164) sigrtmax
You can use Pgrep and pidof to view the process PID directly, the difference between the two commands is that pidof is an exact match, and Pgrep supports fuzzy matching:
[Email protected] ~]# pgrep ssh16212793
CTRL + Z can let the process run in the background, through the jobs command can see the process running in the background, BG background PID and FG PID can let the process run in the background or the foreground, to kill the process running in the background, you can use the command: kill-9%1 (PID running in the background):
By using the Nohup command, the process runs in the background, even if the terminal is closed, and the process continues to run:
[Email protected] ~]# nohup Firefox%>/dev/null &
This article is from the "Ordinary Road" blog, please be sure to keep this source http://linjohn.blog.51cto.com/1026193/1598759
RHCE7 Learning Notes 5--monitoring and managing processes