Commands.page Logo

How to Display Process State in htop on Ubuntu

This article provides a quick guide on viewing process status codes within the htop utility on Ubuntu. It covers enabling the state column and interpreting common flags like running, sleeping, and zombie processes to help you monitor system health effectively.

Install and Launch htop

If you have not installed htop yet, open your terminal and run the following command:

sudo apt update
sudo apt install htop

Once installed, launch the application by typing:

htop

Locate the State Column

By default, htop usually displays the process state in a column labeled S or STATE. Look at the header row at the top of the process list. If you do not see this column, you may need to add it manually.

To add the column: 1. Press F2 to enter the Setup menu. 2. Navigate to the Display options or Columns tab. 3. Find STATE in the available columns list. 4. Press Enter or the Spacebar to add it to the displayed columns. 5. Press F10 to save and exit.

Understand Process State Codes

Once the column is visible, you will see single-character codes representing the status of each process. Here are the most common states you will encounter:

Monitoring these states helps identify performance bottlenecks. For example, a high number of D states may indicate disk I/O issues, while Z states suggest a parent process is not cleaning up child processes correctly.

Exit htop

To close the system monitor and return to your terminal prompt, simply press the q key on your keyboard.