BASH - fix the display
Sometime my R & D result into weird output. You will be not able to access your bash 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.
Fixing the display
For example, accidentally you run cat command over binary file (try cat /bin/bash)

To fix the display just type the reset command. It will initialization terminal again for you.
$ reset
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):
$ clear
Read man pages of stty and reset for more information:
man stty
man reset
You may also be interested in other helpful articles:
- Howto add pause prompt in a shell script ( bash pause command )
- How to debug a Shell Script under Linux or UNIX
- Shell scripting tip: Find the length of a string under UNIX / Linux oses
- Howto display error message instantly when command fails
- Less is more: the hidden treasure of less command
Discussion on This Article:
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!
Tags: change terminal line settings, print terminal line settings, reset command, stty command, terminal initialization



I can’t count the number of times I’ve screwed my terminal up like this. Usually I just close the window. Thanks for the fix!
same here joe. I use to close bash window.
this is great fix
Glad to know *this display fix* is helping all of you.
Appreciate your feedback
This did not work for me. I guess I’m stuck killing the terminal and starting over, but I don’t understand what could go so awry that stty and reset don’t help…