Recover Your Screen on Linux and Unix

Start out with the classics (NOTE: All examples will be given as command line mock-ups which end in a carriage return or enter-key press – I’m assuming you’ll be typing blind)

1. See if you can clear the screen the obvious way

host # clear

2. Or maybe resetting it might help

host # reset

3. stty is also usually available on most Linux and Unix distributions, and it has a sanity check built in. Worth a shot:

host # stty sane

4. tput is also fairly common. You can use it to clear your screen, or reset it, almost like the first two options did (just from a different angle):

host # tput clear

5. and…

host # tput reset

6. Or you can use it to re-initialize the screen (gross oversimplification, but you just want your screen back, right? ;)

host # tput init

7. Finally, you can try to get it to sort out the garbage on your screen by resetting the bold and underline definitions (this makes no sense to me at all, but it works sometimes;)

host # tput sgr 0 0

8. If your shell built-in echo can do this, it’s fairly easy to take this route:

host # echo -e \033c

9. And, if it doesn’t (or you just can’t tell because your characters are still all goofed), you can type the control characters directly:

host # echo ^[c <– Which, if you don’t want to check out the link above, translates to typing: echo and then ctl-v followed by hitting the escape key and then typing the regular letter c