Linux ps Command: Inspect Running Processes
ps shows a list of processes at the time of execution. It is used to check the PID, user, status, and command to investigate whether a particular service or task is actually running.
What is the ps command?
ps outputs a snapshot at a single point in time and then ends. If you want to see values that change in real time, use top or htop. The option notation includes both POSIX and BSD styles, so the meaning can differ depending on whether a hyphen is used.
Basic syntax
ps [options]
The installed implementation and options may vary depending on the distribution. Check the description for the current system with man ps.
Examples
Processes of the current terminal
When run without arguments, it usually only shows processes connected to the current terminal.
ps
System-wide processes
It provides a broad view of the user, PID, parent PID, and command.
ps -ef
Specifying fields of a specific PID
If you specify only the necessary columns, it is easier to read scripts and check results.
ps -p 1234 -o pid,ppid,user,stat,cmd
How to Read Process Columns
ps shows a snapshot of processes at the time of execution. By specifying columns, you can clearly distinguish PID (process ID), PPID (parent PID), status, and command name.
ps -o pid,ppid,stat,comm -p $$
Example output (numbers will vary each time you run it):
PID PPID STAT COMMAND 4321 4100 Ss bash
$$ is the PID of the current shell. The first letter of STAT indicates the state such as running or waiting, and the following letters indicate additional states. Since processes may terminate immediately after being queried, make sure to verify the PID and command again before executing a termination command.
Main Options and Format
| Options/Format | Description |
|---|---|
-e |
Select the entire process. |
-f |
Output in detailed format. |
-p PID |
Select only the specified process ID. |
-o column_list |
Specify the fields and order to be output. |
aux |
View all user processes and resource information in BSD style. |
Precautions when using
ps | grep name can include the grep process itself in the results. pgrep is convenient for searching PIDs by name. Since processes can be created and terminated quickly, make sure to check again that the PID is still the same task before sending a signal right after the output.
Frequently Asked Questions
What is the difference between ps and top?
ps prints a snapshot of the process list at the moment it is executed and then exits. top periodically refreshes the screen so you can observe changes over time.
Official Documentation
The exact behavior of options and implementation differences can be found in the official ps documentation.









