Can You Use a Mouse in htop on Linux?
The Linux htop command-line tool fully supports mouse
interactions, allowing users to click on menus, select processes, and
navigate the interface without relying solely on keyboard shortcuts.
While traditionally run in a terminal environment where keyboard
commands dominate, modern terminal emulators pass mouse click events
directly to htop. This quick overview covers how mouse
support works in htop, how to use it to manage processes,
and what to do if your mouse clicks are not registering.
How Mouse Clicks Work in htop
When you launch htop in a compatible terminal emulator,
it enables mouse tracking mode. This translates your physical mouse
clicks into actions within the text-based user interface (TUI). You do
not need to configure any special plugins or extensions; the
functionality is built directly into the tool.
What You Can Click On
Almost every interactive element on the htop screen
responds to a mouse click:
- The Function Key Menu: At the very bottom of the
screen, you will see a row of options corresponding to keyboard function
keys (such as
F1 Help,F3 Search,F5 Tree, andF9 Kill). Clicking on any of these text labels triggers the action immediately, just like pressing the physical key on your keyboard. - Process Selection: You can click directly on any running process in the main list to highlight it. Once a process is highlighted, any action you take—such as killing the process or viewing its specific threads—will apply to that selected item.
- Column Sorting: Clicking on the column headers at
the top of the process list (such as
PID,CPU%,MEM%, orPRI) will instantly sort the process list by that specific metric. Clicking the same header a second time reverses the sort order. - Setup and Configuration Menus: If you enter the
setup menu by clicking
F2 Setup, you can click through the various categories, meters, and display options to customize your layout.
Troubleshooting Unresponsive Mouse Clicks
If you click on the htop interface and nothing happens,
the issue is usually related to your terminal configuration rather than
htop itself.
- Terminal Emulator Support: Ensure you are using a modern terminal application (like GNOME Terminal, iTerm2, Alacritty, or Windows Terminal) that supports xterm mouse reporting.
- The Shift Key Override: Many terminal emulators
reserve the mouse left-click for selecting and copying text. If your
terminal is capturing the click for text selection, holding down the
Shiftkey while clicking can sometimes bypass the terminal’s override and send the click directly tohtop. - SSH Connections: If you are accessing a remote Linux server via SSH, your local terminal must support passing mouse events over the network protocol. Ensure your SSH client has mouse forwarding or terminal emulation features enabled.