How to Change the htop Update Interval?
The htop command-line utility is a powerful, interactive
system monitor for Linux that provides a real-time view of processes,
CPU usage, and memory consumption. By default, htop
refreshes its metrics every 2 seconds, but this frequency can be easily
adjusted to suit your monitoring needs. This article explains how to
configure the update delay interval using two primary methods: passing a
command-line flag upon launch, or modifying the delay dynamically from
within the interactive interface.
Method 1: Using the Command-Line Delay Flag
The quickest way to launch htop with a custom refresh
rate is by using the -d (delay) command-line flag. This
flag accepts an integer representing the update interval in tenths of a
second.
To use this method, open your terminal and append the delay value to the command:
htop -d [value]
For example, if you want htop to refresh every 5
seconds, you would multiply 5 by 10 and enter 50 as the value:
htop -d 50
Conversely, if you need high-frequency tracking and want the data to update every half-second (0.5 seconds), you would pass a value of 5:
htop -d 5
Method 2: Adjusting the Delay Inside htop
If htop is already running, you do not need to close the
program to change how fast the data refreshes. You can use standard
keyboard shortcuts to alter the delay interval on the fly.
- Increase the delay: Press the
+key (orShift+=on some keyboards) to slow down the refresh rate, adding more time between updates. - Decrease the delay: Press the
-key to speed up the refresh rate, forcinghtopto update system metrics more frequently.
Each keypress adjusts the update interval by one-tenth of a second, allowing for precise control over system resources while monitoring.