1. Technology
You can opt-out at any time. Please refer to our privacy policy for contact information.

Discuss in my forum

Text-Terminals on Linux


18.12 Displays Escape Sequences

You may see something like "5;35H22,1" or "3;4v" or "1;24r" or "^[[21;6H", etc., etc. Of course, the numbers and letters will be different. They will be scattered about (either randomly or in a strange sense of order). The display will look a mess and will likely have other defects. Some application and commands will result in corrupted displays.

What you see are escape sequences (or fragments of them) that were sent to your terminal in order to control it, but your terminal didn't recognize them and passed them on to the screen. It's likely that the program you're using erroneously thinks you are using another type of terminal. Thus it sends escape sequences that your terminal doesn't understand. This can sometimes do strange things to your display. Check that the TERM environment variable is set correctly (type: echo $TERM).


The problem of getting TERM right can be a bit more complex if you use telnet. Telnet doesn't emulate a terminal but passes the value of your TERM variable to the remote computer. If the remote computer doesn't support your type of terminal, or changes the value of TERM to a wrong value (on the remote) then there's trouble. Telnet should initially set the value of TERM correctly on the remote. But changes to the value of TERM (on the remote) could be caused by an incorrect shell configuration file there. The first thing to do is to check the value of TERM, both on your computer and on the remote. The above is overly simplified since it's possible for your telnet client to present the remote server with a list of possible TERM values which your computer supports (if telnet knows that your computer can emulate more than one terminal type).

Terminal set to display escape sequences

Another possible cause is that your terminal happens to be in a special mode where it displays the escape sequences instead of executing them. Then you'll also see them on the screen but they will display in an orderly fashion. This mode is more precisely, one that displays control codes. But since each escape sequence starts with a control code (the "escape" character), the whole escape sequence is not recognized by the terminal and is passed along to the screen. See Control Codes.

* License

* Text Terminal How-To Index

  1. About.com
  2. Technology
  3. Linux

©2014 About.com. All rights reserved.