How to use htop in Linux?
Published on Aug. 22, 2023, 12:17 p.m.
How to sort htop processes by CPU usage?
To sort the htop processes by CPU usage, you can press the “F6” key or “>” key to open the sort field submenu, then use the arrow keys to select the “PERCENT_CPU” option, and press “Enter” to apply the sorting. Alternatively, you can press the “F5” key or “t” key to switch to tree view, and then use the same sorting method to sort the processes by their CPU usage within their respective trees.
How to filter htop processes by name or command?
To filter htop processes by name or command, you can press the “F3” key or “/” key to open the search prompt, then type in a keyword or a partial command name and press “Enter”. This will highlight the processes that match the keyword or the command name. You can then use the arrow keys to navigate through the filtered processes. Additionally, you can use the “F4” key or “" key to enable incremental process filtering, where you can type in part of a process command line and only processes whose names match will be shown. To cancel filtering, enter the filter prompt again and press “Enter” with a blank query.
How to show only user processes in htop?
To show only user processes in htop, you can press the u
key in htop. This will bring up a menu that allows you to filter the process list by user. From the user filter menu, you can select the specific user whose processes you want to view. Once you have selected the user, htop will only display the processes owned by that user.
Alternatively, you can start htop with the -u
option followed by the username whose processes you want to view. For example, to view only the processes owned by the user “jdoe”, you can use the following command:
htop -u jdoe
This will start htop and display only the processes owned by the user “jdoe”.