# # # #1. Process Definition # # #
Process is the work that the CPU does not complete
# # # #2. PS Command # # #
Ps
A # #关于当前环境的所有进程
X| -A # #所有进程
F # #显示进程从属关系
E # #显示进程调用环境工具的详细信息
L # #长列表显示进程的详细信息
U # #显示进程的用户信息
-A # #显示shell前台运行命令的进程 but does not guarantee the shell itself
PS Ax-o%cpu,%mem,user,group,comm,nice,pid,stat # #指定显示进程的某些信息
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/9D/44/wKiom1l85BGAInJCAAEX20lqh1o799.png "title=" Screenshot from 2017-07-29 09-27-36.png "alt=" Wkiom1l85bgainjcaaex20lqh1o799.png "/>%cpu ## Display process CPU load
%mem # #显示进程内存负载
user # #进程用户
group # #进程组
comm # #进程名称
nice # #进程优先级
pid # #进程的id
Stat # #进程状态
# # # #stat中显示的信息
s # #进程状态
l # #内存中有锁定空间
n # #优先级低
< # #优先级高
+ # #前台运行
s # #顶级进程
PS ax-o%cpu,comm--sort <+|-%cpu > <+|-%mem> # #按照进程信息排序
+& nbsp; # #正序
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M02/9D/43/wKioL1l85E_ydW_-AADYUab1BmA703.png "title=" Screenshot from 2017-07-29 09-32-57.png "alt=" Wkiol1l85e_ydw_-aadyuab1bma703.png "/>-# #倒序
%CPU # #cpu负载排序
%mem # #内存负载
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/9D/43/wKioL1l85JqTTQwGAADYUab1BmA672.png "title=" Screenshot from 2017-07-29 09-32-57.png "alt=" Wkiol1l85jqttqwgaadyuab1bma672.png "/>
# # # #3. Process Priority # # # #
1. Priority scope of the process
-20~19
2. Priority view
PS Ax-o Pid,nice,comm
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M00/9D/44/wKiom1l85NHS5DtUAADoQahTIMA255.png "title=" Screenshot from 2017-07-29 09-37-22.png "alt=" Wkiom1l85nhs5dtuaadoqahtima255.png "/>
3. Specify a priority to open the process
Nice-n Priority Numeric Process name
Nice-n-5 Vim & # #开启vim并且指定程序优先级为-5
4. Change the process priority
Reince-n Priority Digital Process PID
Renice-n-5 1806 # #改变1806进程的优先级为-5
[Email protected] ~]# PS a-o pid,nice,comm
PID NI COMMAND
614 0 Xorg
1128 0 Agetty
1625 0 Bash
1785 0 Vim
1806-5 vim
1824-5 vim
1835 0 PS
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/9D/43/wKioL1l85jny82ozAAE3xhwYJjs115.png "title=" Screenshot from 2017-07-29 09-43-57.png "alt=" Wkiol1l85jny82ozaae3xhwyjjs115.png "/>### #4. Front and back calls to processes in the Environment # # # #
Jobs # #查看被打入环境后台的进程
CTRL + Z # #把占用终端的进程打入后台
FG Jobsnum # #把后台进程调回前台
BG Jobsnum # #把后台暂停的进程运行
Comm & # #让命令直接在后台运行
650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M02/9D/43/wKioL1l85n7xjQDwAAAnocGtcMs771.png "title=" Screenshot from 2017-07-29 09-52-45.png "alt=" Wkiol1l85n7xjqdwaaanocgtcms771.png "/>
# # # #5. Process Signal # # #
1. Common signal levels
1 # #进程重新加载配置
2 # #删除进程在内存中的数据
3 # #删除鼠标在内存中的数据
9 # #强行结束单个进程 (cannot be blocked)
# #正常关闭进程 (may be blocked)
# #运行暂停的进程
# #暂停某个进程 (cannot be blocked)
# #把进程打入后台 (can be blocked)
Man 7 Signal # #查看信号详细信息
Kill-Signal Process PID
Killall-Signal Process name
Pkill-u Student-Signal
SIGHUP terminating process terminal line hang-off
SIGINT terminating process Interrupt process
Sigquit establish core file termination process, and generate core file
Sigill Creating a core file illegal directive
SIGTRAP build core file tracking self-trapping
Sigbus establishing a core file bus error
SIGSEGV creating core file Segment Illegal error
SIGFPE creating a core file floating point exception
Sigiot creating a core file to perform I/O self-trapping
SIGKILL Terminate process Kill process
Sigpipe terminating a process writing data to a pipeline that does not have a read process
Sigalarm Terminating process timer to
SIGTERM terminating process software termination signal
SIGSTOP stop signal stop process non-terminal
SIGTSTP stop signal to stop the process terminal
Sigcont ignore signal continue execution of a stopped process
Sigurg ignoring signal I/O emergency signal
SIGIO ignoring the signal descriptor can be I/O
SIGCHLD Ignore signal Notify parent process when child process stops or exits
Sigttou Stop process background process write terminal
Sigttin Stop process background process read Terminal
SIGXGPU terminating process CPU time-out
SIGXFSZ termination process file length too long
Sigwinch ignoring signal window size changes
SIGPROF terminating process statistics distribution graph with timer to time
SIGUSR1 terminating a process user-defined signal 1
SIGUSR2 terminating a process user-defined signal 2
SIGVTALRM terminating process virtual timer to time
1) SIGHUP
This signal is issued at the end of the user terminal connection (normal or abnormal), usually in the terminal control
At the end of the process, notify each job in the same session, and the control terminal
is no longer associated.
2) SIGINT
program termination (interrupt) signal, which is emitted when the user types Intr characters (usually ctrl-c)
3)
Sigquit and SIGINT are similar, but are controlled by the Quit character (usually ctrl). Process in response to receipt
Sigquit exit will produce a core file, in this sense similar to a program error letter
No..
4)
Sigill executed an illegal instruction. This is usually due to an error in the executable file itself or an attempt to execute
Data segment. This signal can also be generated when a stack overflows.
5)
The SIGTRAP is generated by a breakpoint instruction or other trap instruction. Used by debugger.
6)
The SIGABRT program itself discovers the error and calls abort when it is generated.
6)
The Sigiot is generated on the PDP-11 by the IoT instructions, on other machines and SIGABRT.
7)
Sigbus illegal address, including memory address alignment (alignment) error. Eg: access to a four word length
Integer, but its address is not a multiple of 4.
8)
SIGFPE is emitted when a fatal arithmetic operation error occurs. Includes not only floating-point arithmetic errors, but also overflow
The sum of the divisor is 0 and all other arithmetic errors.
9)
The SIGKILL is used to immediately end the run of the program. This signal cannot be blocked, processed and ignored.
10)
SIGUSR1 left for users to use
11)
SIGSEGV attempts to access memory that is not allocated to itself, or attempts to write data to a memory address that does not have write permissions.
12)
SIGUSR2 left for users to use
13)
Sigpipe Broken Pipe
14)
The SIGALRM clock timing signal calculates the actual time or clock time. The alarm function uses the
Signal.
15)
SIGTERM program End (terminate) signal, unlike Sigkill, the signal can be blocked and
Processing. Usually used to ask the program to exit normally. The shell command kill default produces this
A signal.
17)
At the end of the SIGCHLD child process, the parent process receives this signal
Upload Image Search
.
18)
Sigcont let a stop (stopped) process continue execution. This signal cannot be blocked. can be used
A handler that allows the program to complete a specific application when the stopped state changes to continue execution.
Job. For example, to re-display the prompt
19)
SIGSTOP the execution of the Stop (stopped) process. Notice the difference between it and terminate and interrupt:
The process is not over yet, just pausing execution. This signal cannot be blocked, processed or ignored.
20)
SIGTSTP stops the process from running, but the signal can be processed and ignored. When a user types Susp characters
(usually ctrl-z) sends this signal
21)
Sigttin when a background job wants to read data from a user terminal, all processes in that job receive Sigttin
Signal. By default, these processes stop executing.
22)
Sigttou is similar to Sigttin, but is received when writing a terminal (or modifying terminal mode).
23)
Sigurg is generated when "emergency" data or Out-of-band data arrives at the socket.
24)
SIGXCPU exceeds CPU time resource limit. This limit can be read by Getrlimit/setrlimit/
Change
25)
Sigxfsz exceeds the file size resource limit.
26)
SIGVTALRM virtual clock signal. is similar to SIGALRM, but calculates the CPU time that is consumed by the process.
27)
Sigprof is similar to SIGALRM/SIGVTALRM, but includes the CPU time used by the process and the system call
Time.
28)
Sigwinch when the window size changes.
29)
The SIGIO file descriptor is ready to start the input/output operation.
60L
SIGPWR Power Failure
There are two signals to stop a process: Sigterm and Sigkill. Sigterm is friendly and the process captures the signal and shuts down the program according to your needs. Before you close the program, you can end the open record file and complete the task you are doing. In some cases, if the process is working and cannot be interrupted, the process can ignore the sigterm signal.
For Sigkill signals, the process cannot be ignored. This is a "I don't care what you are doing, stop immediately" signal. If you send a sigkill signal to the process, Linux will stop the process there
# # # #6. User Login Audit # # # #
1
W # #查看使用系统的当前用户有那些
W-f ##-f see where to use
2
Last # #查看用户登陆成功历史
3.
LASTB # #查看用户登陆未成功历史
# # # #7. Top command # # #
Top # #监控系统负载工具
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M02/9D/44/wKiom1l8482Q6qakAAF_whRuGYw446.png "title=" Screenshot from 2017-07-30 03-35-17.png "alt=" Wkiom1l8482q6qakaaf_whrugyw446.png "/>
This article is from the "13122425" blog, please be sure to keep this source http://13132425.blog.51cto.com/13122425/1952040
Linux Cloud Automation Operations Basics 7 (process)