What are some of the more important or common processes in Linux?
How can I view a list of processes and use resources?
How do I kill a process?
Process Management class Commands:
Pstree, PS, top, Vmstat, Htop, Pmap
PS Command Process Status (report a snapshot of the processes)
Select the process run at a point in time
Options:
A: All terminal-related processes
x: All processes unrelated to the terminal
U: User-centric display of process-related information
E: Show All Processes
F: Full Format list
F: Show additional information
H: Show Process Hierarchy relationship
O: Custom Field Display
Common options:
Ps-l: Check your bash program
Output:
F: Process flags indicate permissions for this process
4: Indicates that the permission for this process is root
1: Indicates that this child process can be replicated only and cannot actually execute
S: Status of the process
R: in operation
S: Sleep, but can be awakened
D: Sleep state that cannot be awakened, usually this process may be waiting for I/O
T: Stop state
Z: (Zombie) Zombie State
UID/PID/PPID: Process ID of the user ID/process/parent process
C:CPU usage Rate
Pri/ni:priority/nice abbreviation, which indicates the priority level
Addr/sz/wchan: Memory-related
Addr is the kernel function that represents the part of the process in memory
SZ indicates the memory consumed by the process
Wchan Indicates whether the process is running
TTY: Related terminal, no "?" Said
Cmd:command abbreviation that causes this program to be triggered by the command
PS aux: View all running programs
Output:
User: Account number
%CPU:CPU usage Rate
%MEM: Consumption of actual memory ratio
VSZ: Virtual Memory size
RSS: Non-interactive physical memory
STAT:
S:sleeping can be interrupted
D: Non-disruptive sleep
R: Running or operational
T: Terminate
Z: Zombie
S:session leader
L: Multithreaded Process
+: Foreground process
N: Low-priority process
<: high-priority process
START: Change the current state of the process to the same as the S identity in Ps-l
Time: Change process time to use CPU runtime
Command: The actual order to change the process
Top command Display Linux tasks
Options:
-D: followed by seconds, which is the number of seconds the entire process decrypts the update, default 5 Seconds
-B: Perform the top in batch mode
-N: Used in conjunction with-B to perform several top
-P: Specify a PID to monitor
shortcut keys:
?: Displays key commands currently available at top
P: Sort display with CPU usage resources
M: Sort using resources in memory
N: Sort by PID
T: Cumulative sorting by the process using CPU time
K: Give a signal to a PID
R: Set a nice value for a PID
Q: Exit
Output:
PID: Process ID
User: Username
Pr:priority priority, smaller level larger
The Ni:nice value, which is related to the priority, is also smaller sooner executed
%CPU:CPU usage Rate
TIME+:CPU Usage Time Accumulation
Note:
Top default Sort by%cpu
Htop command
Additional installation Required
pstree Command (display a tree of processes)
Options:
-A: connections between each process tree are connected in ASCII characters
-U: Connections between the process trees are UTF8 characters
-P: List PID for each process
-U: Lists the owner of each process
Inter-process communication: IPC
Signal: Signal
1 Sigup Let the process not terminate, and reread its configuration file
2 SIGINT interrupt a running process, equivalent to CTRL + C
9 SIGKILL Kill Process
SIGTERM Normal termination process
SIGSTOP equivalent to CTRL + Z pause a process
View Help: Man 7 signal
To pass a signal to another process, use the Kill
Kill-signal PID
Kill can pass a signal to a job (%jobnumber) or to a PID
Linux Job Control
Jobs command to view job information
CTRL + Z: Send the job from the foreground to the background, and the process will stop executing
BG Jobid process will run in the background
FG%jobid recalled to reception
Kill%jobid kills the job
Linux Process Management