If you have ever used cat or tail to accidentally show a binary file, you will have noticed your terminal show graphical garbage instead of readable text. As shown in the screenshot below:
You will find several suggested fixes on the internet for this, including:
- type CTRL-C a few times to make sure you are on a new line and then enter ‘reset‘ and tap enter.
- output the ASCII SI (shift in) character, decimal value 15. This can be entered with CTRL+O and should work if the reset command doesn’t work. Just enter ‘echo CTRL+V CTRL+O’ on the command line
- enter the command ‘stty sane’, followed by ‘tput rs1’ on the command line.
The only one that worked for me is entering the following (blindly, since you can ‘t read what your are typing) on the terminal prompt:
echo -e "\033c"
A good practice is to define an alias in your startup script with the following command:
alias resetterminal='echo -e "\033c"'
Next time you have this problem, you can then type (blindly) ‘resetterminal’ to fix the problem.