ps command is an abbreviation of Process Status.
linux ps command is used to list those processes currently running on the system.
The ps command lists the snapshots of the current processes, that is, the processes at the moment when the ps command is executed.
If you want to dynamically display the process information, you can use the
linux top command.
To monitor and control processes, you must understand the state of the current process.
The Linux process has five states:
D : uninterruptible sleep (usually IO) I : Idle kernel thread R : running or runnable (on run queue) S : interruptible sleep (waiting for an event to complete) T : stopped by job control signal t : stopped by debugger during the tracing W : paging (not valid since the 2.6.xx kernel) X : dead (should never be seen) Z : defunct (“zombie”) process, terminated but not reaped by its parent Syntax [email protected]:~$ ps [options] Common command parameters
PS has a lot of parameters, only a few commonly used parameters are listed here and the meaning is roughly introduced.
-A Select all processes. Identical to -e.
-a Select all processes except both session leaders and processes not associated with a terminal.
-e Identical to -A.
-u Select by effective user ID or name.
-f Shows the relationship between processes.
-o Specify user-defined format.
-au Shows more detailed information.
-aux Shows all processes that contain other users.
Example 1. To see every process on the system [email protected]:~$ ps -e | head -15 [email protected]:~$ ps -ef | head -15 2. To see every process on the system [email protected]:~$ ps ax | head -15 [email protected]:~$ ps au | head -15
[email protected]:~$ ps aux | head -15 3. To see every process with a user-defined format: [email protected]:~$ ps -eo pid,tid,class,rtprio,ni,pri,psr,pcpu,stat,wchan:14,comm | head -15 4. Print only the name of PID 1: [email protected]:~$ ps -q 1 -o pid,tid,comm
More about linux commands：
Linux Commands Tutorial