How to Fix htop Frozen or Unresponsive?
When the htop interactive process viewer freezes or
becomes completely unresponsive in a Linux terminal, it typically
indicates that the terminal emulator has intercepted a control signal,
the SSH session has dropped, or the system is experiencing severe
resource exhaustion. This article provides a quick troubleshooting guide
to help you safely force-quit a frozen htop session,
recover your terminal functionality, and diagnose the underlying cause
of the system lockup without needing to reboot your entire machine.
Step 1: Break the Terminal Lock with Keyboard Shortcuts
Before closing your terminal window entirely, try using standard Linux signal shortcuts to regain control. Sometimes the interface is just paused rather than completely broken.
Ctrl + C: Sends theSIGINT(Interrupt) signal. This is the most common way to force-quit an unresponsive command-line tool.Ctrl + Q: If you accidentally pressedCtrl + S, your terminal may have entered “XOFF” mode, which stops the terminal from accepting input and makes it appear frozen. PressingCtrl + Qresumes the output flow.- **
qorF10**: These are the standard exit commands forhtop. If the freeze is minor, spamming these keys might gracefully close the application.
Step 2: Terminate htop from a Second Terminal Session
If keyboard shortcuts fail, the htop process itself is
likely stuck in an Uninterruptible Sleep state (D state) or your
terminal session is completely dead. You will need to open a secondary
terminal window or connect via a new SSH session to kill the
process.
First, find the Process ID (PID) of your frozen htop
instance using the pgrep command:
pgrep htop
Once you have the PID, attempt to terminate it gracefully using the
SIGTERM signal:
kill <PID>
If the process still refuses to close, force it to shut down
immediately by sending the SIGKILL signal:
kill -9 <PID>
Step 3: Recover a Glitched Terminal Screen
Sometimes htop dies but leaves your terminal emulator in
a broken state where your cursor is missing, text formatting is
corrupted, or typed characters do not appear on the screen.
To fix this, simply type the following command in the affected terminal and press Enter:
reset
This re-initializes the terminal state, clearing the screen buffer and restoring normal text inputs.
Common Causes of htop Freezes
Understanding why htop froze can help prevent it from
happening again in the future:
- Severe I/O Wait: If your system is waiting on a
failing hard drive, a stalled network mount (like NFS), or an extremely
slow USB drive,
htopcan freeze if it attempts to read the/procfilesystem while the kernel is blocked. - Total Memory Exhaustion (OOM): When a system
completely runs out of RAM and swap space, the kernel may lock up or
invoke the Out-Of-Memory Killer. If
htopitself is frozen, the entire operating system might be on the verge of crashing. - SSH Timeout: If you are using
htopover a remote server connection, a brief drop in your internet connection can freeze the terminal display, making it look likehtopcrashed when the connection was actually lost.