0

I was using a Linux console and suddenly the format of the letters changed:

console linux with bad letter format

I probably pressed on the wrong keys. Any idea how to fix this?

1

Such garbage may be an aftermath of a command that output binary data to your console. Usually you don't want commands to do this. Still it's possible due to a bug or some mistake. Example:

You wanted to cat file where file is a text file, you made a typo and run cat fild where fild happened to be a binary file.

In such scenario some particular byte sequences may be interpreted by your terminal emulator as control sequences or so, they will affect its later behavior.

To fix this:

  1. Press Ctrl+C few times in case some process is still running or you have something in the command line you typed blindly.
  2. Type reset.
  3. Hit Enter.

From man 1 reset:

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. Note, you may have to type

<LF>reset<LF>

(the line-feed character is normally control-J) to get the terminal to work, as carriage-return may no longer work in the abnormal state. Also, the terminal will often not echo the command.

So the more foolproof version of the command seems to be:

  1. Type Ctrl+JresetCtrl+J.

My experiences (particularly in tmux) show in some cases reset may not help; still it usually does.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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