1. Process Management
A program is loaded in memory, called a process
Linux is a PID to distinguish between different processes
PS is used to list the current process
Aux lists all the processes
-eu all processes for the current user
LAX lists more long format information
-EF List All Processes
J List Job Information
PS aux
VSZ: The amount of memory the process requested
RSS: System-Allocated memory size
Tty:?? Indicates that the process is running in the background
STAT: Indicates the status of the process
T indicates that the process is temporarily suspended;
The Z process has just been terminated [zombie process];
The R process is included in the plan, but does not enter the CPU;
S enter the waiting state;
D The process cannot be interrupted;
PS LAX
Ps-eu
2. controling Job
This script is called a job (while true; do echo-n ' testjob ' >>/tmp/1.txt; Sleep 1; Done
CTRL +c can end a running job;
(while true; do echo-n ' testjob ' >>/tmp/1.txt; Sleep 1; DONE) &//job is transferred to the background
Jobs view the running process
FG 1 Transfer the job from the background to the foreground
Ctrl +z pauses the foreground program and moves it to the background
BG 1 will suspend the program in the background, resume running in the foreground
End Process
End Job
First, the job to the front desk, and then end with CTRL + C
2) End Process
Method one: kill-9 force kill process
JOBS-PL view the job's process number
Kill-9 31263
Method Two: Killall-9 process name (not recommended)
Method Three: Kill-9 PPID
PS J in PS J, kill process need to kill Ppid number
Kill-9 31640
Pkill End all processes for a user
-U terminates the corresponding process based on the user name the process belongs to
-T terminates the corresponding process based on the terminal
Who are the users who are logged in?
Pkill-u student kills all student user processes
Pkill-9-T PTS/1 kills all PTS/1 processes
Top can dynamically view the status of active process resources
Z-label Color
C Sort by CPU
M Sort by memory
T sort by occupation time
K Kill Process
Q exit
PR
NI
VIRT Virtual Memory usage
The use of RES memory
DD Disk rewrite 8 times, data not recoverable
DD If=/dev/zero Of=/dev/null &
K
Linux 124 Course 7, Process management