Commands.page Logo

How to Display Threads in htop on Ubuntu Linux

This article confirms that htop can display individual threads and provides the steps to enable this view on Ubuntu. It outlines the keyboard shortcut required to toggle thread visibility and explains how to identify threads within the process list for more granular system monitoring.

Yes, htop can display threads instead of grouping them under a single process. By default, htop shows only the main process IDs to keep the interface clean, but you can expand this view to see every thread associated with each process. This is particularly useful for debugging multi-threaded applications or identifying specific threads consuming high CPU resources.

To enable thread view, launch htop from your terminal. Once the interface is active, simply press the H key on your keyboard. This acts as a toggle switch. When enabled, you will see additional lines appear indented beneath the main process ID. These indented lines represent the individual threads belonging to that process. Each thread will have its own LWP (Light Weight Process) ID listed in the PID column.

If you prefer using the menu, press F2 to open the Setup screen. Navigate to the Display options section. Look for the checkbox labeled Show threads and enable it. Press F10 or Esc to save and exit the setup menu. The main screen will now reflect the changes immediately.

When threads are visible, the CPU and memory usage columns reflect the consumption of each specific thread rather than the aggregated total for the process. This allows you to pinpoint exactly which thread is causing a performance bottleneck. To return to the default process view, press the H key again. You can exit htop completely by pressing q or F10.