Full Byte Developer.

Terminal stuck? Do not close the window

Most stuck states have a one key exit. Closing the window hangs up every job running in it.

Published here · 6 sources

Terminal stuck? Do not close the window. Closing it hangs up every job running in it. Most stuck states have a one key exit.

The fix block

  1. Output stopped (you hit Ctrl+S): press Ctrl+Q

  2. SSH session frozen: press Enter, then ~ then .

  3. Prompt turned into > (zsh: dquote>): the shell wants you to finish the command, often an open quote. Press Ctrl+C

  4. Typing shows nothing or text is garbled: type reset and Enter, even if you cannot see it (if Enter does nothing: Ctrl+J, reset, Ctrl+J)

  5. Ctrl+Z and the program vanished: it is stopped, not gone. Type jobs to see it, fg to bring it back

  6. Stuck in a man page or git log: press q

Notes

Fixes 3, 4 and 5 are confirmed on Mac (bash 3.2, zsh 5.9). Ctrl+Q works while flow control (ixon) is on.

Send this to the friend who closes the whole terminal every time vim or less traps them.

Keep this guide

By Full Byte Developer

Filed under Dev tools

Questions about this guide

What does Ctrl+Q do?

It resumes output stopped by Ctrl+S (flow control).

How do I escape a frozen SSH session?

Press Enter, then ~ then . (tilde dot).

Sources

  1. OpenBSD man: sshman.openbsd.org
  2. Zsh docs: PS2 parameterzsh.sourceforge.io

Next in this stack