How to Bulk Select Processes in htop?
The htop interactive process viewer is a powerful tool
for monitoring system resources in Linux, but it also allows you to
manage multiple processes simultaneously. While many users know how to
kill a single process using the F9 key, managing large
groups of processes requires bulk selection. By using the
Spacebar to tag individual processes or specific
shortcut keys to tag entire process trees, you can select multiple
entries at once. Once tagged, any action you perform—such as killing
processes, changing their nice values, or pinning them to specific CPU
cores—will apply to the entire selection simultaneously.
Step-by-Step Guide to Bulk Selection
To perform bulk actions in htop, you must first “tag”
the target processes. Tagged processes will change color (usually
turning yellow or bold, depending on your terminal color scheme) to
indicate they are selected.
- Navigate to the Target Process: Use the Up and Down Arrow keys to scroll through the process list and highlight the first process you want to select.
- Tag the Process: Press the Spacebar. You will notice the process highlights in a different color, and the cursor automatically moves down to the next line.
- Select Additional Processes: Continue moving up or down and pressing the Spacebar on every process you want to include in your bulk action.
- Untag a Process: If you accidentally select the wrong process, simply highlight it again and press the Spacebar to deselect it.
Bulk Selecting Entire Process Trees
If you need to select a parent process and all of its child processes (for example, multiple workers of a web server or browser tabs), tagging them individually can be tedious. You can select them all at once using the tree view shortcut.
- Switch to Tree View: Press
F5to organize the process list into a hierarchical tree format. - Tag a Process Tree: Highlight the parent process at
the top of the branch and press
c(lowercase c). This will automatically tag the parent and all of its nested child processes. - Untag a Process Tree: Press
cagain on the parent process to clear the selection for that entire branch.
Clearing All Selection Tags
If you have selected dozens of processes across your system and want to clear all tags instantly without scrolling through the list, use the global untag shortcut:
- Press
U(uppercase U, orShift + u) to unmark all currently tagged processes across the entire system.
Executing Bulk Actions on Tagged Processes
Once you have successfully selected your group of processes, you can execute a command that applies to all of them at the same time. The most common bulk actions include:
- Bulk Kill / Send Signals (
F9): PressF9. Select your desired signal (such asSIGTERMfor a clean exit orSIGKILLfor a forced termination) from the left-hand menu and pressEnter. The signal will be sent to every tagged process at once. - Bulk Renice (
F7/F8): PressF7to increase the priority (reduce the nice value) orF8to decrease the priority (increase the nice value) for all selected processes simultaneously. - Bulk CPU Affinity (
a): Pressato open the CPU affinity menu, where you can check or uncheck specific CPU cores. PressingEnterwill force all tagged processes to run only on your selected cores.