After running programs that output unrecognizable code, the whole shell would be full of unrecognizable code.

alt text

How can I correct this?

  • Looks like it changed the characters set/encoding of the shell. Not sure how to set it back though. – Matthew Lock Nov 11 '09 at 2:44

SI/SO VT100 Control Characters

The garbled characters are likely due to the terminal getting a SI character (Shift In; ASCII 14; Control-N). SI is a VT100 control character that can cause the terminal to switch to an alternate character set. Many real terminals (e.g. an actual hardware device, or just the text-only console of an OS) and terminal programs honor this escape code.

The direct way to switch back to the normal character set is to send a SO character (Shift Out; ASCII 15; Control-O) to the terminal.


Because the character set is switched, you may have to type the recovery commands “blind” (without relying on seeing what you have typed).

Usually the echo command will be useful. Often you can type
E C H O Space Control-V Control-O Enter / Return
to get the terminal to see a Control-O (the Control-V tells the input-side of the terminal that the next is to be passed literally, otherwise the input side will ‘eat’ the character before it gets the the shell and thus before it can be sent back to the output side of the terminal).

If you can assume a reasonable shell with a printf builtin (or no shell builtin and a reasonable external printf command), you can use printf '\017' to send a Control-O to the terminal.

|improve this answer|||||
  • If anyone ever runs into this problem on a terminal that is not derived from a VT100, an alternative to the VT100-specific control sequence generated via echo or printf is tput rmacs (as pointed out in another answer by Ignacio Vazquez-Abrams). – Chris Johnsen Oct 10 '10 at 3:35
  • the answer is correct but by having the E C H O shown as caps I'm afraid you might mislead someone into typing them in caps ... which would fail. – CarlF Jun 17 '11 at 16:15

Did you try the unix reset command?

This is usually the result of dumping a binary file (a program, or a data file) to the terminal (cat some.mp3 or similar). Usually typing reset will get your terminal back in order. If that doesn't work, the next thing to try is a reset function on your terminal application -- look for it in the application's menus. (PuTTY, for example, has a Reset Terminal in its system menu.)

Rarely, neither of these work, and you'll just have to shut down that terminal or shell and start another one.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.