Commands.page Logo

How to Hide Kernel Threads in htop on Ubuntu

This guide explains how to configure the htop process viewer to hide kernel threads by default on Ubuntu. By modifying the htop configuration file, you can reduce clutter in the process list and focus on user-space applications without needing to toggle settings every time you launch the tool.

Edit the htop Configuration File

To set this preference permanently, you must modify the htoprc configuration file located in your home directory. Ensure that htop is not currently running before making these changes to prevent the active session from overwriting your edits upon exit.

  1. Open your terminal.

  2. Open the configuration file using a text editor like nano:

    nano ~/.config/htop/htoprc

    Note: If this file does not exist, run htop once, press F10 to quit, and then try opening the file again.

  3. Locate the line that reads hide_kernel_threads=0.

  4. Change the value from 0 to 1 so it looks like this:

    hide_kernel_threads=1
  5. Save the file by pressing Ctrl + O, then exit nano by pressing Ctrl + X.

Verify the Configuration

Launch htop by typing htop in the terminal. The process list should now exclude kernel threads automatically. If you need to temporarily view kernel threads, you can press F2 to access the setup menu, navigate to Display options, and toggle Hide kernel threads during the session. Press F10 to save any interactive changes back to the configuration file.