htop is one of the most popular system monitors for Linux. It is an improved version of the top utility and allows the user to monitor the processes on his system in real time.
Top 10 hotkeys in htop
Before looking at all the functional keyboard shortcuts available in htop, let's start with the top 10 keyboard shortcuts and look at each of them in more detail.
F1 Help
The F1 key in htop opens the help documentation, which explains all the functional keyboard shortcuts available in the application.
F2-Setup
The F2 key opens the settings menu, which allows the user to customize htop to their liking. This includes changing the color scheme, defining value thresholds, and other settings.
In addition, in the F2 settings menu you will find the following submenus:
Display options - here you can set display options in htop. For example, you can change the sort order of processes, show or hide custom columns, adjust the screen refresh rate, and more.
Columns - This menu allows you to select which columns will be displayed for each process. Htop offers many options, such as CPU usage (processor usage), RAM usage (RAM usage), process start time and others.
Process Sorting - In this menu, you can choose how processes will be sorted in htop. You can sort processes by CPU usage, RAM usage, startup time, etc.
Setup Hotkeys - In this menu, you can set up hotkeys for quick access to the most commonly used htop functions.
General Options - here you can configure general htop options such as displaying system information, choosing a color scheme, and other options.
Meter Options - This menu allows you to set thresholds for various parameters such as CPU usage, RAM usage, etc. When a parameter reaches the set threshold, htop will display it in red to draw the user's attention.
Display Filtering - This menu allows you to configure process display filters. For example, you can hide system processes, show only the processes of a certain user, or only show processes running in a certain directory.
Other Options - Various other options for htop can be configured here, such as using the cache, displaying information about floppy disks, and more.
F3-Search
The F3 key opens a search bar that allows the user to quickly find a process by its name or ID.
The F3 key in htop opens a search bar that allows the user to quickly find a process by its name or ID. To use this function, the user must simply press F3 and enter part of the name or process ID to be found. htop automatically filters the list of processes and displays only those that contain user-entered text.
In addition, the search bar can also be used to filter processes by other parameters. For example, the user can enter ">50%" to display only those processes that are using more than 50% of the processor, or "S" to display only processes in the sleeping state.
To cancel the search and return to the full list of processes, the user can press the Esc or Backspace key.
F4-Filter
The F4 key allows the user to filter processes by specified parameters. For example, you can filter out processes using more than 50% of CPU or memory.
The F4 key in htop opens the filter menu, which allows the user to filter the list of processes by given parameters. When opening the filter menu, the user can select a filter type such as processor, memory, or other parameter and enter a threshold value to filter the list of processes.
For example, if the user selects the filter type "CPU" and sets the threshold to 50%, then htop will display only those processes that are using more than 50% of the CPU. Similarly, the user can filter processes by memory usage, process state, username, and other options.
Once the user has set the filter options, they can press the Enter key to apply the filter, and htop will automatically update the process list to match the filter options.
F5-Tree view
The F5 key switches the process view to a tree view that shows dependencies between processes and their parent processes.
The F5 key in htop switches the process view to a tree view that shows dependencies between processes and their parent processes. In this mode, processes are displayed as a tree, where each process is a child of another process, and the topmost process is the init process.
The tree view in htop allows the user to easily track dependencies between processes, identify and kill parent processes and their children. In the tree view, each process is displayed with its ID (PID), name, CPU and memory usage, and status.
The F5 key also allows the user to quickly switch between normal and tree view. When using the tree view, the user can switch between processes using the arrow keys and the Page Up and Page Down keys.
F6-Sort
The F6 key allows the user to sort processes by a given parameter, such as CPU usage, memory, or startup time.
The F6 key in htop allows the user to sort processes by a given parameter. Pressing F6 brings up a list of sort options such as CPU usage, memory, startup time, and others. The user can select one of these options, and the processes will be sorted in ascending or descending order by the value of this option.
For example, if the user chooses to sort by CPU usage, the processes will be sorted in descending CPU usage, i.e. the most active processes will be displayed at the top of the list. If the user chooses to sort by memory, the processes will be sorted by memory usage, with the most expensive processes at the top of the list.
Using the F6 key, the user can also select the sort direction: ascending or descending by the value of the selected parameter. The F6 key allows you to quickly find the most expensive processes on the system and manage them more efficiently.
F7, F8 - Nice +/-
The F7, F8 key allows you to change the process nice priority value, which allows the user to control the process priority and change the CPU usage.
The F7 key in htop allows the user to change the nice priority value of a process. nice-priority is a value that determines the priority of the process in the CPU scheduling queue. The higher the nice priority value, the lower the priority of the process, and the less likely it is to be executed quickly.
The F7 key allows the user to change the nice priority of a process between -20 and 19. -20 is the highest priority and 19 is the lowest priority. Changing the nice priority value can help the user manage process priority and manage CPU usage. For example, if a process is taking up too many resources, the user can set a higher nice priority for another process to give it more CPU usage.
F9-Kill
The F9 key allows you to kill the process selected by the user. After pressing F9, a message will be displayed asking you to confirm the deletion of the process.
The F9 key in htop allows the user to terminate (kill) the selected process. After pressing F9, the user will be prompted to confirm their choice to ensure that they are not closing an important process.
When the user presses F9, htop sends a signal to the process, telling it to exit. Normally, a process receives a SIGTERM signal, which alerts the process to shutdown and gives it time to complete its activities and save data before closing.
If the process does not terminate after receiving the SIGTERM signal, the user can try to force quit the process using the "Force Quit" option. However, using this option may result in the loss of unsaved data, so it should be used with caution.
F10 Quit
The F10 key allows the user to close htop and exit the program.
Tab - Toggle between process list and CPU usage meters
The Tab key allows you to switch between viewing processes and CPU usage metrics. When selecting CPU Metrics, the screen displays CPU usage graphs rather than a list of processes.
Additional functional keyboard shortcuts in htop
PgUp / PgDown - allow you to scroll up and down the list of processes.
Home / End - allow you to move to the beginning and end of the list of processes.
Space - marks the selected process.
U - filters the list of processes by the user who started the process.
Ctrl + L - Refreshes the screen and redraws htop output.
Shift + H - Displays only those processes that use the most CPU.
Shift + M - Displays only those processes that use the most memory.
Ctrl + S - saves the current settings in a configuration file.
Ctrl + R - loads settings from a configuration file.
Ctrl + F - Displays a search box at the top of the screen, allowing the user to search for a specific process by its name.
These keyboard shortcuts provide the user with additional options when working with htop, which help to make process monitoring more convenient and efficient.
We also suggest you other useful articles: