5

After running cat on some files I get the infamous 'bushes': ␌⎺└⎻⎼␊⎽⎽␊␍ ├▒⎼ °␋┌␊. B␊├├␊⎼ ┤⎽␊ ├▒⎼'⎽ ≥ which I believe are result of encoding being changed. Is there any way to recover the terminal after the encoding has changed?

Caleb
  • 70,105
matcheek
  • 718

2 Answers2

12

Run reset. From the man page:

When invoked as reset, tset sets cooked and echo modes, turns off cbreak and raw modes, turns on newline translation and resets any unset special characters to their default values before doing the terminal initialization described above. This is useful after a program dies leaving a terminal in an abnormal state.

Michael Mrozek
  • 93,103
  • 40
  • 240
  • 233
9

tput sgr0, tput rmacs, or tput reset. reset is usually but not always even more complete than tput reset. (Turn off all special output modes; turn off alternate character set, which is usually but not always included in sgr0; send terminal reset string which often does those and more.)

It can be useful to embed tput sgr0 at the beginning of $PS1.

geekosaur
  • 32,047