Understanding the htop Command

Basic Usage of htop

The htop command is an interactive process viewer for Unix systems. It is similar to top, but provides a more user-friendly, colorful interface and additional features for managing processes.

htop [OPTIONS]

Options Available with htop

-h (Help)

Display help information:

htop -h

-v (Version)

Display version information:

htop -v

-C (Color Mode)

Run in color mode:

htop -C

This option forces color output.

-d (Delay Time)

Set the delay between updates:

htop -d 3

This sets the update interval to 3 seconds.

-p (PID)

Display only the process with the specified PID:

htop -p 1234

-s (Sort By)

Specify the sort order:

htop -s %CPU

This sorts processes by CPU usage.

Interactive Commands within htop

F1 (Help)

Open the help menu.

F2 (Setup)

Access the setup menu to customize htop.

F3 (Search)

Search for a process.

F4 (Filter)

Filter the displayed processes based on user input.

F5 (Tree View)

Toggle the tree view of processes.

F6 (Sort By)

Change the sort column for the displayed processes.

F9 (Kill Process)

Send a signal to a selected process to terminate it.

F10 (Quit)

Exit htop.

Examples of htop Command

View All Running Processes

htop

This launches htop and displays all running processes in real-time.

Run htop with a Specific PID

htop -p 1234

This displays only the process with PID 1234.

Run htop with a Custom Delay

htop -d 2

This sets the update interval to 2 seconds.

Display htop in Color Mode

htop -C

This forces color output in htop.

Summary of Options

Option Description
-h Display help information.
-v Display version information.
-C Run in color mode.
-d Set the delay between updates.
-p Display only the specified PID.
-s Specify the sort order.