Sometimes you just happen to cat a binary file and it just messes up your terminal output and all can see and type is garbage.
Normally here you’d just give up and reopen your terminal but here’s another solution: Just type the command below:
echo -e \\033c
All you’re doing is sending an ESC(033 is the octal version of the ASCII control key “ESC”) + a letter “c” to the console, which is a VT100 command to reset the terminal to its default settings. If you’re curious about other VT100 commands, take a look at this page. You can send them all using
followed by the the codes in ASCII. This works in any VT100 compatible terminal which means that you’re safe to use it on your Linux or Mac machine.
Edit: As some people said in the comments and at G+, you can just use the “reset" command, which is actually doing the above and some more.
To read more about the reset command, check the man pages here.