When you are managing a Linux server, you don’t have a graphical Task Manager or Activity Monitor to show you what programs are running in the background. If a web server crashes or a script freezes, you must use the command line to investigate.
The standard tool for viewing running processes in Linux is the ps command (which stands for “process status”).
The Basic ps Command
If you open a terminal and simply type:
ps
It will return a very short, almost useless list. By default, ps only shows the processes that were started by your current user, inside your current terminal session. It won’t show system background services, database servers, or processes owned by the root administrator.
The Essential Command: ps aux
To see a complete, detailed snapshot of every single thing running on the entire Linux machine, you must use flags. The universally memorized combination is aux.
Type the following command:
ps aux
- a: Shows processes for ALL users, not just yourself.
- u: Displays the data in a user-oriented format (providing detailed columns for CPU and RAM usage).
- x: Shows processes that are not attached to a terminal (like hidden background daemon services).
Understanding the Output Columns
When you run ps aux, it prints a massive data table. The most important columns are:
- USER: The Linux user account that launched the program (e.g.,
rootorwww-data). - PID: The Process ID. This is a unique number assigned to the program. (You need this number if you want to use the
killcommand to force-close the app). - %CPU: The percentage of processor power the program is currently consuming.
- %MEM: The percentage of RAM the program is consuming.
- COMMAND: The actual name of the program or script that is running (e.g.,
/usr/sbin/apache2).
How to Find a Specific Program
Because ps aux usually prints hundreds of lines of output, finding one specific frozen script is difficult. You can combine ps aux with the grep search command to filter the list instantly.
For example, to find all running processes related to the Nginx web server, type:
ps aux | grep nginx
This will filter out all the noise and only print the lines containing the word “nginx”, allowing you to quickly find the PID and system resources for that specific application.