My Slackware TTY can be broken easily by running:

cat some_binary_file

After the command, the entire TTY will no longer display readable characters but still responds to keyboard events.

Even if I logout and login again, the TTY is still broken and does not show readable characters anymore. I must restart the machine to restore normal TTY operation.

Is there a solution without restarting entire machine?

up vote 12 down vote accepted

Run echo ^v^o, that is echo and then Ctrl-v and then Ctrl-o, Enter. You will not see the Ctrl-v. It will display as echo ^O. Ctrl-v sets it into verbose mode, passing through control characters, and the Ctrl-o will reset the terminal.

  • 4
    Just a short hint: If the TTY is completely unusable or a logging console you can reset it easily from any other TTY with echo ^v^o > /dev/ttyN where N is the number of the terminal. – Torben Feb 24 '14 at 11:52
  • This doesn't work for me on MacOSX (10.11.6) / iTerm2 (3.0.12) / bash (4.1.2) – Ed Randall Feb 8 '17 at 13:45

Usually, running reset resets the terminal. Some key bindings from .inputrc might be lost, though.

  • Super simple solution that fixed my crashed tmux oh-my-zsh pane. – Shadoninja May 10 '16 at 23:14

You can try the ANSI reset command:

printf "\033c"
  • this is the only one that worked on OpenBSD 5.4 – execNext Oct 1 '14 at 1:55
  • 1
    This also worked from the shell (bash) as echo -e '\033c' – Ed Randall Feb 8 '17 at 13:43
  • 2
    @EdRandall Yes. Note that "echo -e" is not supported by all shells while printf has the advantage of being portable so works whatever the shell, including bash. – jlliagre Feb 8 '17 at 14:53
  • I imagine that this has nothing to do with the seagull diacritic in IPA? U+033C ‹◌̼› \N{COMBINING SEAGULL BELOW} – TRiG Jul 3 '17 at 14:14
  • @TRiG Indeed. Nothing to do either with the famous Eric Cantona's quote. ;-) – jlliagre Jul 3 '17 at 14:34

My terminal didnt display any characters I typed. None of the other tricks worked. This one works:

stty sane

Worked for me. I sometimes have a terminal in an unresponsive state, but none of the other suggestions could give me the output back again. The other suggestions I tried, but didn't work:

echo ^v^o
reset
printf "\033c"

Source: https://unix.stackexchange.com/a/79686/53236

There are actually a few potential problems, and it might have to do with your environment. First off, as @Jesper answered, you want to do stty sane. However, you might not even be able to set up the environment correctly with that.

This is due to the difference between /bin/bash and /bin/sh. Upon opening your tty, run /bin/bash and then try stty sane. This should fix everything. Finally, I recommend adding such a thing to .bashrc

Another option would be to install a sane tty software.

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.