USD ($)
$
United States Dollar
Euro Member Countries
India Rupee

Viewing Running Processes

Lesson 26/49 | Study Time: 20 Min

Viewing running processes is a fundamental Linux task essential for monitoring system resource usage, diagnosing performance issues, and managing active applications.

Linux provides several commands and tools that allow users and administrators to inspect all processes currently executing on the system, including detailed information on CPU and memory usage, process IDs, parent-child relationships, and command invocation.

Using the ps Command to List Processes

The ps (process status) command displays snapshots of currently running processes. It provides detailed information such as process IDs (PID), associated users, start times, memory and CPU utilization, and the command invoked.

Common usage:

text
ps aux


a: Shows processes for all users.

u: Displays user-oriented format including user and memory usage.

x: Lists processes not attached to a terminal.


Example output snippet:

text
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.1 168656 4780 ? Ss Oct11 0:21 /sbin/init
user 2345 2.1 1.0 230000 21000 pts/0 R+ 10:00 0:05 top

Using top for Real-Time Process Monitoring

Linux provides top as an interactive utility for monitoring system activity. Following are the key aspects of using top effectively.


1. top provides a dynamically updating list of running processes ordered by CPU usage by default.

2. Displays system-wide resource consumption: CPU, memory, swap, load averages.

3. Users can interact with top to sort by memory, kill processes, or renice them.

4. Start it by typing:

text
top


5. Press q to quit top.

Enhanced Process Viewer with htop

Linux users rely on htop for detailed and color-coded process information. Following are the core capabilities of the htop tool.


1. htop is an improved, interactive text-mode process viewer with color-coded output.

2. Features scrollable process list, tree view, detailed CPU/memory graphs.

3. Allows killing and renicing processes via function keys.

4. Install with:

text
sudo apt install htop # Debian/Ubuntu
sudo dnf install htop # Fedora


5. Run with:

text
htop

Other Useful Commands to View Processes


  • pgrep and pidof: Find the process IDs of named processes.
text
pgrep firefox
pidof sshd


  • Listing hierarchical process relationships:
text
ps -ejH
ps axjf
pstree


  • View processes by user:
text
ps -u username
Samuel Wilson

Samuel Wilson

Product Designer
Profile

Class Sessions

1- What is Linux and Operating System Concepts 2- Linux History and Evolution 3- Linux Distributions and Their Purposes 4- Open Source Software and Licensing 5- Graphical User Interface (GUI) and Desktop Environments 6- Terminal Access and Command-Line Fundamentals 7- Getting Help and Command Documentation 8- File System Hierarchy and Directory Structure 9- Navigating Directories and Listing Contents 10- Creating, Copying, and Moving Files and Directories 11- Deleting Files and Directories 12- Symbolic and Hard Links 13- Understanding File Permissions Model 14- Modifying Permissions and Ownership 15- User and Group Management 16- Sudo and Privilege Escalation 17- Text Searching and Pattern Matching 18- Text Processing and Stream Editing 19- Compressing and Archiving Files 20- Text Editing and File Creation 21- Package Management Systems Overview 22- Installing and Updating Software with APT 23- Installing and Updating Software with YUM/DNF 24- Managing Software from Non-Repository Sources 25- Understanding Processes and Process Management 26- Viewing Running Processes 27- Process Control and Termination 28- Task Scheduling with Cron 29- Networking Concepts and IP Addressing 30- Viewing and Configuring Network Interfaces 31- Basic Network Troubleshooting 32- Shell Script Basics 33- Variables and Data Types 34- Conditional Logic in Scripts 35- Loops and Iteration 36- Functions and Code Reuse 37- Input/Output and User Interaction 38- System Authentication and Access Control 39- File System Security 40- Software Updates and Patching 41- Basic Firewall Concepts 42- System Information and Monitoring 43- Service and Daemon Management 44- System Boot Process and Runlevels 45- System Backup and Disaster Recovery 46- Comprehensive File System Management 47- System Automation Workflows 48- Multi-Concept Troubleshooting Scenarios 49- Continued Learning Pathways