LinuxDevCenter.com
oreilly.comSafari Books Online.Conferences.
BooksAll ArticlesSafari BookshelfO'Reilly GearFree Newsletters

FAQS
 FAQs
Apache FAQ
Linux FAQ
XML FAQ

Log in to particpate





TECH JOBS


   Linux FAQ > 7. Solutions to Common Miscellaneous Problems
Question:  7.14. The Screen Is All Full of Weird Characters Instead of Letters.
Answer:

You probably sent some binary data to your screen by mistake. Type echo '\033c' to fix it. Many Linux distributions have a command, reset, that does this.

If that doesn't help, try a direct screen escape command.

   $ echo 'Ctrl-V Ctrl-O'


This resets the default font of a Linux console. Remember to hold down the Control key and type the letter, instead of, for example, Ctrl, then V. The sequence

   $ echo 'Ctrl-V Esc C'


causes a full screen reset. If there's data left on the shell command line after typing a binary file, press Ctrl-C a few times to restore the shell command line.

Another possible command is an alias, "sane," that can work with generic terminals:

     $ alias sane='echo -e "\\033c";tput is2; \
     > stty sane line 1 rows $LINES columns $COLUMNS'


The alias is enclosed with open quotes (backticks), not single quotes. The line break is included here for clarity, and is not required.

Make sure that $LINES and $COLUMNS are defined in the environment with a command similar to this in ~/.cshrc or ~/.bashrc,

     $ LINES=25; export $LINES; $COLUMNS=80; export $COLUMNS


using the correct numbers of $LINES and $COLUMNS for the terminal.

Finally, the output of "stty -g" can be used to create a shell script that will reset the terminal:

  1. Save the output of "stty -g" to a file. In this example, the file is named "termset.":

              $ stty -g >termset
    


    The output of "stty -g" (the contents of "termset") will look something like:

              500:5:bd:8a3b:3:1c:7f:15:4:0:1:0:11:13:1a:0:12:f:17:16:0:0:73
    


  2. Edit "termset" to become a shell script; adding an interpreter and "stty" command:

               #!/bin/bash
               stty 500:5:bd:8a3b:3:1c:7f:15:4:0:1:0:11:13:1a:0:12:f:17:16:0:0:73
    


  3. Add executable permissions to "termset" and use as a shell script:

               $ chmod +x termset
               $ ./termset
    


[Floyd L. Davidson, Bernhard Gabler]


This FAQ is from Linux Frequently Asked Questions with Answers, maintained by Robert Kiesling

Sponsored by:

Contact UsMedia KitPrivacy PolicyPress NewsJobs @ O'Reilly
Copyright © 2000-2006 O’Reilly Media, Inc. All Rights Reserved.
All trademarks and registered trademarks appearing on the O'Reilly Network are the property of their respective owners.
For problems or assistance with this site, email