Linux under the PS command detailed
There are 5 states of processes on Linux:
1. Run (running or waiting in the run queue)
2. Interrupted (dormant, obstructed, waiting for a condition to form or receive a signal)
3. Not interrupted (Received signal does not wake up and not run, the process must wait until the interruption occurs)
4. Zombie (process terminated, but process descriptor exists until the parent process calls the WAIT4 () system call to release)
5. Stop (process received Sigstop, SIGSTP, Sigtin, Sigtou signal after stop running)
The PS tool identifies 5 status codes for the process:
D non-disruptive uninterruptible sleep (usually IO)
R run runnable (on run queue)
S Interrupt Sleeping
T stop traced or stopped
Z Zombie a defunct ("zombie") process
Name: PS
Use Rights: All users
Use mode: PS [options] [--help]
Description: Shows the dynamic of the instantaneous stroke (process)
Parameters:
PS parameters are very many, here only a few common parameters and introduce the meaning
-A lists all journeys
-W display widens to show more information
-au displays more detailed information
-aux shows all travel with other users
AU (x) output format:
USER PID%cpu%mem VSZ RSS TTY STAT START time COMMAND
User: Trip Owner
Pid:pid
%CPU: Utilization of CPU usage
%mem: Occupancy of memory usage
VSZ: Virtual Memory size occupied
RSS: Size of memory consumed
TTY: Secondary device number for the terminal (minor device numbers of TTY)
STAT: The status of the trip:
D: Non-disruptive stillness
R: In progress
S: Stationary state
T: Suspend execution
Z: not exist but cannot be eliminated for the time being
W: Not enough memory paging to allocate
High-priority itinerary
N: Low priority sequence of travel
L: Memory paging allocation and lock in memory (instant system or endure a I/O)
Start: Travel time
Time: Timing of execution
Command: The instructions that are executed
Example:
Ps
PID TTY Time CMD
2791 ttyp0 00:00:00 tcsh
3092 Ttyp0 00:00:00 PS
% ps-a
PID TTY Time CMD
1? 00:00:03 Init
2? 00:00:00 kflushd
3? 00:00:00 Kpiod
4? 00:00:00 KSWAPD
5? 00:00:00 Mdrecoveryd
.......
% Ps-aux
USER PID%cpu%mem VSZ RSS TTY STAT START time COMMAND
Root 1 0.0 0.7 1096 472? S Sep10 0:03 init [3]
Root 2 0.0 0.0 0 0? SW SEP10 0:00 [kflushd]
Root 3 0.0 0.0 0 0? SW SEP10 0:00 [Kpiod]
Root 4 0.0 0.0 0 0? SW SEP10 0:00 [KSWAPD]
The specific order is explained as follows:
1 PS A shows all the programs under the current terminal, including other user's programs.
2) ps-a Show All Programs.
3 PS C listing the program, display the actual instruction name of each program, and does not include the path, parameters or the indication of resident service.
4) Ps-e The effect of this parameter is the same as the specified "A" parameter.
5 PS e When the program is listed, display the environment variables used by each program.
6) PS F Displays the tree structure with ASCII characters, and expresses the relationship between the programs.
7) ps-h display tree structure, indicating the relationship between programs.
8 Ps-n shows all the programs except the ones that perform the PS instruction terminal.
9 PS s adopts program signal format to display program status.
PS S lists the program, including the interrupted subroutine data.
One) ps-t< terminal number >
Specify the terminal number and list the status of the procedure belonging to the terminal.
PS u
Displays program status in a user-oriented format.
PS X
Show All programs, not by terminals.
The most common approach is to Ps-aux, and then use a pipe symbol to guide grep to find a particular process and then operate on a particular process.