PS Introduction to Commands:
This command is used to view a user process.
1 . Command format:
ps [option]: PS parameter
Common use format: PS aux |grep ' keyword ' to find related process information by keyword
[[Email protected] ~]# PS aux display information for all processes
USER PID%cpu%MEM VSZ RSS TTY STAT START time COMMAND
Root 1 0.0 0.0 2900 1436? Ss 21:04 0:02/sbin/init
Root 2 0.0 0.0 0 0? S 21:04 0:00 [Kthreadd]
Root 3 0.0 0.0 0 0? S 21:04 0:00 [migration/0]
Root 4 0.0 0.0 0 0? S 21:04 0:00 [ksoftirqd/0]
Root 5 0.0 0.0 0 0? S 21:04 0:00 [migration/0]
Parse displays the meaning of the message: (the process in brackets above is the kernel process)
User: Username PID: Process number%cpu: Percentage of CPU consumed by process%MEM: Percentage of process memory
VSZ: Virtual memory consumption size RSS: Actual memory footprint TTY: Terminal mode
STAT: Process state start: Process start time: Process runtime command: Commands to start a process
2 . Command function:
View user processes.
Process Status Classification:
D: Non-disruptive sleep status
R: Run or Ready state
S: An interruptible sleep state
T: Stop state
Z: Zombie State
Process Type classification: (processes with brackets are kernel processes)
<: high-priority process
N: Low-priority process
+: Processes in the foreground process group
L: Multithreaded Process
S: The first process of session connection process
3 . Command parameter: PS No parameter shows foreground process only by default
A: Displays all terminal-related processes (that is, processes that start with the user's login)
U: Show the process is initiated by that user
X: Displays all terminal-independent processes (that is, processes that are started when the user is not logged on after the system starts)
Common formats
-e: Show All Processes
-L: Show processes in long format
-F: More detailed display of process information than L
-O: Specifies that a field in the process is displayed
Pstree: Process tree view process tree can be viewed by keyword pstree |grep "keyword"
Pgrep: The process number of the process is displayed in grep only Usage:pgrep bash shows the process number about the bash process
[[email protected] ~]# pgrep-u root bash View Bash-related processes running as root user
2036
Pidof: Displays only the process number (PID) of processes, which can be found by process name Usage:pidof sshd
Top
4 . Command instance:
This article is from the "Learn Linux history" blog, please be sure to keep this source http://woyaoxuelinux.blog.51cto.com/5663865/1879035
Linux command: PS pstree top Process Management