Process Management
Managing processes is a crucial aspect of working with the command line. This section covers basic commands for starting, stopping, and monitoring processes in Bash.
top
top provides a real-time view of system processes. It displays a dynamic view of running processes and system resource usage.
top

In this example, top is used to display a real-time view of system processes.
You can press q to exit top.
htop
htop is an interactive process viewer that provides a more user-friendly and feature-rich alternative to top.
You can install it using the package manager of your Linux distribution.
sudo apt install htop -y
After installing htop, you can run it using:
htop

In this example, htop is used to display a real-time view of system processes.
You can press q to exit htop.
kill
kill is used to send a signal to a process, typically to terminate it.
kill <pid>
For exemple, kill 1234 sends the default SIGTERM signal to process 1234.
Here are some useful flags you can use with kill:
| Flag | Description |
|---|---|
-9 |
Forcefully terminate a process (SIGKILL). |
-l |
List all signal names. |
pkill
pkill is used to send signals to processes based on their name or other attributes.
pkill -f process_name
For example, pkill -f firefox sends the default SIGTERM signal to all processes matching "firefox".
Here are some useful flags you can use with pkill:
| Flag | Description |
|---|---|
-u |
Match processes owned by a specific user. |
-x |
Match exact process name. |
Next Step
Now that you are familiar with basic process management, check out the next section on Networking Commands to learn how to manage network-related tasks in Bash.