Linux display currently running processes
Categories:
How to List and Manage Running Processes in Linux

Learn essential commands to view, filter, and understand currently running processes on your Linux system, crucial for monitoring and troubleshooting.
Understanding what processes are running on your Linux system is fundamental for system administration, troubleshooting, and performance monitoring. Whether you're trying to identify resource hogs, debug a misbehaving application, or simply keep an eye on system health, knowing how to list and interpret process information is a vital skill. This article will guide you through the most common and powerful commands used to inspect running processes in Linux.
The ps
Command: Process Status
The ps
command (process status) is one of the oldest and most frequently used utilities for displaying information about currently running processes. By default, ps
shows processes associated with your current terminal session. To get a more comprehensive view, you'll typically use it with various options.
ps aux
ps -ef
Common ps
command variations for comprehensive process listings.
Let's break down the common options:
a
: Shows processes for all users.u
: Displays user-oriented format, including CPU/memory usage, start time, and command.x
: Includes processes not attached to a terminal.-e
: Selects all processes.-f
: Displays full-format listing, providing more details like parent process ID (PPID).
The output of ps aux
typically includes columns like USER
, PID
, %CPU
, %MEM
, VSZ
, RSS
, TTY
, STAT
, START
, TIME
, and COMMAND
. Understanding these columns is key to interpreting the output.
flowchart LR A[User Executes `ps aux`] --> B{Kernel Process Table} B --> C[Retrieve Process Data] C --> D[Format Output] D --> E[Display to User] E --"PID, %CPU, COMMAND, etc."--> F[User Interpretation]
Simplified flow of the ps
command execution.
The top
Command: Real-time Process Monitoring
While ps
provides a snapshot of processes, top
offers a dynamic, real-time view of your system's running processes. It displays a constantly updated list of processes, ordered by CPU usage by default, along with system summary information like CPU load, memory usage, and swap space. This makes top
invaluable for identifying processes that are currently consuming the most resources.
top
Execute top
for an interactive, real-time process view.
Inside top
, you can use several interactive commands:
k
: Kill a process (you'll be prompted for the PID).r
: Renice a process (change its priority).P
: Sort by CPU usage (default).M
: Sort by memory usage.q
: Quittop
.
htop
. It provides a colorful, ncurses-based interface with easy-to-use controls for sorting, filtering, and managing processes.Filtering and Searching Processes with grep
Often, you're not interested in all processes, but rather specific ones. Combining ps
or top
with grep
allows you to filter the output and find exactly what you're looking for. This is particularly useful for finding processes by name or user.
ps aux | grep firefox
ps -ef | grep nginx
ps aux | grep [m]ysql
Filtering process lists using grep
.
The [m]ysql
trick in the last example is a common way to prevent grep
from listing itself in the output when searching for a process name. By putting one character of the search term in square brackets, grep
won't match its own command line.
Managing Processes: kill
and killall
Once you've identified a problematic process, you might need to terminate it. The kill
command sends signals to processes, with the default signal being SIGTERM
(15), which requests a graceful shutdown. If a process doesn't respond, SIGKILL
(9) can be used for an immediate, forceful termination.
# Gracefully terminate process with PID 12345
kill 12345
# Forcefully terminate process with PID 54321
kill -9 54321
# Terminate all processes named 'my_app'
killall my_app
Using kill
and killall
to manage processes.
kill -9
, especially on system processes. Forcefully terminating critical processes can lead to system instability or data loss. Always try kill
without -9
first.