How to Filter htop by User in Linux?
The htop command-line utility is a powerful, interactive
process viewer for Linux that provides a real-time, color-coded overview
of system resources and running processes. While it displays all system
processes by default, you can easily restrict the view to monitor only
the processes owned by a specific user. This article covers how to
filter the htop display both when launching the tool from
the terminal and while interacting with it directly inside the
interface.
Filtering by User on Launch
The quickest way to isolate a specific user’s activity is to apply a
filter flag directly when executing the command in your terminal. This
prevents htop from loading unnecessary system processes
from the start.
To launch htop pre-filtered for a specific user, use the
-u or --user flag followed by the
username:
htop -u usernameFor example, if you only want to monitor processes started by the
user john, you would run:
htop -u johnYou can also use a user’s numerical User ID (UID) instead of their username:
htop -u 1001Filtering by User Inside the htop Interface
If you already have htop running and want to filter the
process list without closing the program, you can use the interactive
menu.
- Press u on your keyboard to open the user filter menu.
- A sidebar will appear on the left side of the screen listing all users currently running processes, along with an option for All users.
- Use the Up and Down arrow keys to navigate through the list of usernames.
- Press Enter to select the desired user.
Once selected, the interface will instantly refresh to display only the processes belonging to that specific individual. To clear the filter and view all system processes again, press u and select All users from the top of the menu list.