If you are a system admin, a developer, or just someone interested in how the system works, knowing how to check the list of active programs is a basic but important skill. It helps users to keep an eye on what your system is doing and manage its workload better.
In Ubuntu 24.04, listing running processes is an important task for anyone managing a Linux system. By considering its significance, this article will explore several methods to list running processes in Ubuntu, ensuring you have the knowledge to keep your system running smoothly.
How to List Running Processes in Ubuntu 24.04
How to List Running Processes in Ubuntu 24.04?
Listing processes in the Ubuntu system serves several purposes, such as monitoring system resources, managing process priorities, and troubleshooting applications. Commands like ps, top, and htop provide an overview of the current processes, allowing system administrators to keep an eye on the system’s health as well as performance.
Let’s explore them one by one with its usage:
Method 1: Using the ps Command
In Ubuntu, the ps command is one of the most basic yet powerful tools for listing processes. It offers a bird-view of the current processes.
List of Running Processes (Current Session):
By itself, ps displays a list of processes associated with your current terminal session. This typically includes commands you’ve recently run and background processes started from your shell:
ps
In the above figure, list down the column information:
PID (Process ID): Unique identifier for the process.
TTY (Terminal): The terminal the process is associated with (may be blank).
TIME: Total CPU time used by the process.
CMD (Command): Name of the command that launched the process.
List of All Processes:
To view information about all running processes on the system, use the -A or -e: options with ps:
ps -A
List of All Running Processes
To list all running processes, you can use the ps command with aux. Here, the “u” option tells ps to list processes for all users, not just the current user. and -x option lists processes that don’t have a controlling terminal:
ps -aux
This command shows a whole list of all running programs. It tells the USER who started each program, how much computer power (%CPU) and memory (%MEM) it’s using, and what action got it started.
USER: This column identifies the username of the process owner.
PID: This is an identifier for each process (unique).
%CPU: This depicts the CPU time the process is using.
%MEM: This shows the memory the process is using.
VSZ: This stands for “Virtual Size” and represents the total amount of virtual memory allocated to the process.
RSS: This stands for “Resident Set Size” and represents the amount of physical memory allocated to the process.
TTY: This refers to the terminal the process is associated with, if any.
STAT: This column shows the state of the process, which can be characters like “S” (sleeping), “R” (running), or “Z” (zombie).
START: This shows the time the process was started.
TIME: This shows the total CPU time used by the process.
COMMAND: This column means the actual command that initializes the process.
Customizing the Output
The ps command offers a wide range of options to filter and format the output. Let’s see the commonly utilized options:
List Processes Owned by the User Root:
In Ubuntu, the ps -u root command enlists processes running under the user root. It provides the system’s active processes, allowing administrators to monitor as well as manage system activity.
ps -u root
Find All Instances of a Specific Process
For more targeted process listing, combining ps with pgrep can assist users in identifying individual processes. For instance, to find all instances of a process named “gnome”, use:
ps aux | pgrep gnome
Display Detailed Information about All Processes
Display a more detailed output format including user, PID, %CPU, %MEM, and command:
ps -ef
Find Processes with Full Command
For enlisting processes with their full command, users can utilize the -x option as below:
ps -x -f
Find Specific Processes (Also Child Processes)
List processes named bash and their child processes, here, -C shows processes with a specific name and their child processes:
ps -C bash
Method 2: Using the top Command
Another essential tool is the top command, which offers a dynamic view of running processes, sorted by CPU usage. It is an interactive tool that allows users to perform actions on processes, such as changing their priorities or killing them. Simply run:
top
Method 3: Using the atop Command
Similarly, atop is another advanced tool that not only lists processes but also provides extensive information about system performance.
sudo apt install atop
atop
Method 4: Using the htop Command
For a more user-friendly interface, htop offers a colorful as well as interactive experience. Install it via the package manager and run:
sudo apt install htop
htop
It shows a comprehensive bird-view of the processes including whole memory, swap, tasks, and threads, and allows for easier navigation.
Note: For system as well as process monitoring guidance, the man pages provide comprehensive information on using these commands effectively.
Conclusion
For listing the running processes in Ubuntu 24.04, users can utilize ps, top, and htop commands. The ps command is a powerful utility for this purpose; using ps -e presents the running processes on the system. For a dynamic view, top is another command that provides an active display of running processes, which is particularly useful for system resources.
Additionally, for a more detailed and user-friendly interface, htop can be installed and used, offering enhanced functionality over top. It’s important to note that while terminating processes, one must be cautious and understand the role of each process to avoid system instability.
Frequently Asked Questions
ps aux
This shows detailed information about every process running on the system, including the user, PID (process ID), CPU and memory usage, etc.
ps -u username
ps aux | grep firefox
sudo apt install htop
After installation, you can run htop to see a colorful, user-friendly interface for monitoring processes. It allows sorting and killing processes interactively.
Leave feedback about this