Terminal Freezes When Running Top or Htop? Fix It Here

Linux & Unix Intermediate 👁 12 views 📅 Jun 15, 2026

Your terminal locks up when running top/htop? Usually a terminal emulator bug or a runaway process. Here's what actually works.

Cause #1: Terminal Emulator Bug with ncurses Rendering

This is the most common cause I see. You're running top or htop in something like GNOME Terminal, Kitty, or Alacritty, and suddenly the whole terminal freezes—no input, no cursor movement, just a frozen screen. The culprit? A buggy ncurses rendering loop that locks up the terminal emulator's input thread.

I had a client last month whose whole dev team couldn't run htop without their terminals freezing. They were all on GNOME Terminal 3.44 with a specific font cache corruption. The fix? Switch to a different terminal emulator temporarily. But you don't always want to do that.

Fix: Kill the terminal with pkill and switch to a TTY

When it freezes, don't force reboot. Hit Ctrl+Alt+F2 (or F3–F6) to switch to a virtual console TTY. Then run:

ps aux | grep -E 'top|htop|gnome-terminal' | grep -v grep
kill -9 [PID of top/htop]

After that, Ctrl+Alt+F1 to go back to your graphical session. The terminal should recover.

Long-term fix: Update your terminal emulator. Or, if you're on an older distro like Ubuntu 20.04, try using tmux inside the terminal—it often sidesteps the ncurses-render bug. I've seen Kitty 0.26 fix this entirely—users on Kitty 0.22 had the freeze, and upgrading sorted it.

Also, check your font cache:

fc-cache -f -v

Corrupted font caches trigger ncurses to misrender characters, causing the terminal to hang. No joke.

Cause #2: A Runaway Process Flooding stdout Sending SIGSTOP to All Processes

This one is sneaky. You run htop, and it shows a process that's gone wild—spamming output to stdout, eating 99% CPU. That process might trigger SIGSTOP from the kernel's OOM handler or from htop itself if you accidentally pressed Ctrl+Z while in its UI. Yes, Ctrl+Z in htop suspends htop, but it can also suspend child processes. If you had multiple shells open, the whole group might be stopped.

I once had a server where a Python script went into an infinite loop writing to /dev/pts/0. Top froze the entire SSH session because the terminal couldn't handle the flood of output. The real fix was killing that script.

Fix: Check for stopped jobs and kill them

From a TTY (use Ctrl+Alt+F2 if your GUI terminal is frozen), run:

jobs -l
kill -9 %1

Or find the stopped process:

ps aux | grep 'T'  # T status = stopped
kill -9 [PID]

If htop itself is stopped (you see it with status T in ps), just kill it. Then restart it cleanly: htop.

Prevention: Don't hit Ctrl+Z inside htop. Use q to quit. If you need to background a process, use screen or tmux.

Cause #3: Terminal Scrollback Buffer Overflow (Memory Exhaustion)

This is rarer but brutal. If your terminal emulator has a huge scrollback buffer (like 10,000+ lines) and you're running htop with a ton of processes, the terminal's memory usage can spike. The result? The terminal process starts swapping, the GUI becomes unresponsive, and your entire desktop might freeze.

I saw this on a client's system with 8GB RAM and 300+ processes. Running htop in GNOME Terminal with unlimited scrollback caused the memory to hit 95%. The terminal froze solid.

Fix: Reduce scrollback and use a lightweight terminal

First, from a TTY, kill the terminal:

pkill -9 gnome-terminal

Then, before reopening, set scrollback to something sane. In GNOME Terminal: Edit → Preferences → Profile → Scrolling → Limit scrollback to 1000 lines. In Kitty: set scrollback_lines 1000 in kitty.conf. In Alacritty: window.scrollback.lines: 1000 in alacritty.yml.

If you're on a low-memory system, use st (simple terminal) or xterm—they don't have large scrollback buffers and won't choke.

Quick test: Before running htop, check your free memory:

free -h

If you're under 2GB free, switch to a lighter terminal or run htop inside screen.

Quick-Reference Summary Table

CauseSymptomImmediate FixLong-Term Fix
ncurses rendering bug in terminal emulatorTerminal freezes after a few seconds of top/htopSwitch to TTY, kill top/htop with kill -9Update terminal emulator or switch to Kitty/Alacritty
Runaway process flooding stdout or SIGSTOPTerminal freezes, but TTY is fine; process shows status TFind stopped process with ps aux | grep T, kill -9 itDon't press Ctrl+Z in htop; use q to quit
Scrollback buffer memory exhaustionWhole desktop becomes sluggish, terminal uses 90%+ RAMpkill -9 terminal emulator from TTYLimit scrollback to 1000 lines or use a lightweight terminal

One last piece of advice: if this keeps happening, try using btm (Bottom) instead of htop. It's a Rust-based process viewer that's less prone to ncurses issues. But that's a different article.

Was this solution helpful?