BASH – Fix The Display and Console Gibberish on a Linux / Unix / OS X / BSD Systems

Posted on in Categories Linux, RedHat/Fedora Linux, Shell scripting, Suse Linux, Sys admin, Tips, Troubleshooting, Ubuntu Linux, UNIX last updated August 8, 2006

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:

Fig.01: Bash fix the display
Fig.01: Bash fix the display

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

Method #2: Use ANSI escape sequence

Another option is to type the following ANSI escape sequence:

echo -e "33c"

Sample outputs from both commands:

Animated gif 01: Fix Unix Console Gibberish Command Demo
Animated gif 01: Fix Unix Console Gibberish Command Demo

Read man pages of stty and reset for more information stty(1),reset(1),bash(1)

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.

11 comment

  1. Hi. I know this sounds stupid. But I would like to know, Where or what subject it. I can search while looking for classes so I can learn how to run Line Print Terminals.
    I worked as a temp on a Mill for a few month operating a locomotive. while working there, I notice that came to fix the machinery got paid 200 $ hour. I want that money!!.

Leave a Comment