To check active processes in a Linux system, you can use several commands, with top and ps being the most commonly used. Here’s how to use them effectively:
1. Using the top Command
The top command provides a dynamic, real-time view of the system's processes. It displays information such as CPU usage, memory usage, and the list of currently running processes.
-
Basic Usage:
top -
Filter for Active Processes: To display only active processes (those using CPU), you can use the
-ioption:top -i -
Exiting
top: Pressqto exit thetopinterface.
2. Using the ps Command
The ps command provides a snapshot of current processes. It can be used with various options to customize the output.
-
Basic Usage:
ps auxThis command shows all running processes with detailed information, including user, CPU usage, memory usage, and command.
-
Filtering for Specific Processes: You can use
grepto filter for specific processes. For example, to find processes related tobash:ps aux | grep bash
3. Using the htop Command (if installed)
htop is an enhanced version of top that provides a more user-friendly interface and additional features.
-
Basic Usage:
htop -
Exiting
htop: Pressqto exit.
Summary
top: Real-time view of active processes.ps aux: Snapshot of all processes.htop: Interactive process viewer (if installed).
Further Learning
To deepen your understanding of process management in Linux, consider exploring relevant labs on LabEx that focus on system monitoring and process management techniques.
If you have any more questions or need further clarification, feel free to ask!
