What Does the F8 Key Do in htop?
The htop command-line utility is a popular interactive
process manager for Linux that provides a real-time, color-coded
overview of system resources and running processes. Within this tool,
the F8 key serves a specific and crucial function: it
decreases the “niceness” (or increases the priority) of
a selected process, allowing it to consume more CPU resources. This
article explains how the F8 key works in htop, the concept
of process niceness, and the administrative permissions required to use
it effectively.
Understanding Process Niceness and Priority
To understand what the F8 key does, it helps to understand the concept of nice values in Linux.
- Nice Value Range: Nice values range from -20 (highest priority) to 19 (lowest priority).
- The Inverse Logic: The lower the nice value, the “less nice” the process is to other processes, meaning it gets more CPU time. Conversely, a higher nice value means the process is “nicer” and yields CPU time to others.
In htop, the F7 and F8 keys are used to adjust these
values on the fly for whatever process you currently have
highlighted.
The Specific Action of F8
When you select a process in htop and press
F8, you are executing the Higher
Priority command.
- Each press of the F8 key subtracts 1 from the selected process’s nice value.
- By lowering the nice value, you are telling the Linux kernel to prioritize this process over others.
- This is highly useful when a critical task (like a heavy compilation or video render) is running too slowly and you want to grant it maximum system performance.
F7 vs. F8: The Quick Reference
It is easy to mix up the two priority-adjusting function keys. Here is how they compare:
| Key | Action in htop | Effect on Nice Value | Effect on CPU Priority |
|---|---|---|---|
| F7 | Nice (Low Priority) | Increases value (+1) | Decreases priority (Slower) |
| F8 | Un-Nice (High Priority) | Decreases value (-1) | Increases priority (Faster) |
Important Permission Restrictions
Because increasing a process’s priority (making it less nice via F8) can negatively impact the performance of the rest of the system, Linux enforces strict security restrictions on this action.
- Standard Users: If you run
htopas a regular, unprivileged user, you can only use F7 to increase the nice value (lower the priority) of your own processes. If you try to press F8 to increase priority,htopwill deny the request. - Root/Sudo Users: To successfully use the F8 key to
lower a nice value or alter processes owned by other users, you must
launch
htopwith root privileges by runningsudo htopin your terminal.