Does htop Support Mouse Wheel Scrolling?
The htop command-line utility for Linux does natively
support mouse wheel scrolling, allowing users to navigate through the
process list and menus using their mouse instead of relying solely on
keyboard shortcuts. However, because htop runs inside a
terminal emulator, the feature depends heavily on the terminal’s
configuration and its ability to pass mouse events to the application.
This article covers how to enable and use mouse scrolling in
htop, troubleshoot common issues where scrolling fails, and
configure your terminal emulator for the best experience.
How Mouse Interaction Works in htop
Unlike the traditional top command, htop
uses the ncurses library to build a richer text-based user
interface. When you launch htop, it attempts to capture
mouse events from the terminal. If your terminal emulator supports it
and has the feature active, you can:
- Scroll vertically through the process list using your mouse wheel.
- Click on specific processes to select them.
- Click on column headers (like CPU%, MEM%, or PID) to instantly sort the process list.
- Click the function keys (F1 through F10) listed at the bottom of the screen to trigger actions like filtering, searching, or killing a process.
Troubleshooting Mouse Scrolling Issues
If you open htop and find that spinning your mouse wheel
does nothing, or if it scrolls your terminal buffer backward instead of
scrolling the process list, the issue is usually caused by your terminal
settings or your multiplexer.
Terminal Emulator Settings
Most modern terminals (such as GNOME Terminal, Alacritty, iTerm2, or
Kitty) pass mouse events to ncurses applications by
default. If yours does not, check your terminal’s preferences. Look for
settings labeled “Report Mouse Tracking,” “Enable Mouse Input,” or “X11
Mouse Tracking” and ensure they are turned on.
Working with Terminal Multiplexers (tmux / Screen)
If you are running htop inside tmux or GNU
Screen, mouse events are often intercepted by the multiplexer
itself.
- In tmux: You must explicitly enable mouse support.
You can do this temporarily by pressing
Prefix(usuallyCtrl+B), typing:set -g mouse on, and hitting Enter. To make this permanent, addset -g mouse onto your~/.tmux.conffile. - In Screen: Add
mousetrack onto your~/.screenrcfile.
The Shift Key Bypass
If you want to highlight and copy text from htop using
your mouse rather than scrolling or clicking UI elements, most Linux
terminals allow you to bypass htop’s mouse capture by
holding down the Shift key while clicking or
dragging.