Sometime my R & D result into weird output on screen. For example, accidentally I run cat command over binary file – cat /sbin/*. You will be not able to access your bash/ksh/zsh based terminal. It will be full of wired character sequences that can lock down your display. These characters will hide what you type or character displayed into strange symbols. To clear gibberish all over the screen use the following method.
Method #1: Fixing the display
Here is my console with gibberish all over the screen:
To fix the display just type the reset command. It will initialization terminal again for you:
If reset command failed to work type the following command to restore the session to a normal state:
$ stty sane
Press CTRL + L to clear the screen (or type clear command):
Method #2: Use ANSI escape sequence
Another option is to type the following ANSI escape sequence:
echo -e "\033c"
Sample outputs from both commands:
Read man pages of stty and reset for more information stty(1), reset(1), bash(1)