LLI Wiki — My Digital Knowledge Base

Reset a garbled Linux terminal

Restore a terminal after binary output using reset, stty sane and tput.

After displaying binary data (for example with cat on a binary file), a terminal can be left in a garbled state. These commands restore it.

Method 1: reset

  1. Press Ctrl+C a couple of times.
  2. Type reset and press Enter.

You will be typing blind, so make sure the command is typed correctly.

Method 2: stty sane

If reset is not enough:

stty sane
tput rs1

Other useful commands

tput reset     # full terminal reset
clear          # clear the screen (also Ctrl+L)
stty -echo     # disable echo of typed characters
stty echo      # re-enable echo
Mastodon LLIMastodon SocialFosstodon