Computing Topics --> Help With Application Programs --> Terminal Applications --> Tera Term (telnet/SSH for Windows) --> Setting the Terminal Type and Backspace Key, Resizing the screen in Unix -->

Setting the Terminal Type and Backspace Key, Resizing the screen in Unix

If a user on a UNIX machine has problems with his or her terminal settings, in such a way that full screen programs do not work or the backspace key just puts either ^H or ^? on the screen, then their terminal type, screen size or erase key needs to be set. Terminal type information is kept in the environment space and as a shell variable (meaning it will only affect that shell if you change it). The backspace key and screen size are part of the ioctl information for the tty. (If you don't know what that is: man -k ioctl.)

The most common cause of problems is the user typed in the wrong terminal type when the .login file asked for it (tset -s -m ':?'), although if the user tries to make a smart .login file which senses where he or she is coming from (via the $term shell variable) it could get set incorrectly there as well. You can use printenv to find out what the values of the term and termcap variables.


If the Terminal Type is Set Correctly/Resizing the Screen

If the terminal type is set correctly, but the screen size isn't then use "eval `resize`" to automatically set the screen size. Unfortunately, some terminal emulations do not properly process these sequences and the screen size gets set to one column by 24 rows or something worse. Another frequent problem is some UNIX programs supply a linefeed at the last column of the screen and the local terminal program also supplies one. When this happens the user sees an extra blank line and finds that none of the lines below this match where the system thinks they are in vi. One solution to fix any of the problems in this paragraph is to manually set the rows and columns using the stty command. The exact sequence is

stty rows #rows columns #columns

In the case of resize not working just set it to the correct size.

One way to fix the double linefeed problem with vi is to tell the system you have one or two less columns that you actually do.


Setting the Backspace Key

For the backspace key, it isn't quite as easy. The problem here is that there are two common backspace codes: backspace and delete. One is ^H, the other is ^?. If you are having problems it is because your terminal program choose the one the system didn't. The default cluster login scripts set it to ^H. One solution is to change the setting in the local terminal emulator. However there are many possible emulators and we can't support them all. So, to fix this on the UNIX side, you have to type the following at the shell prompt:

stty erase ^v<press backspace key right after typing ^v>

The ^v (control - v ) is the "quote character." It keeps the shell from interpreting the next keystroke. This is necessary because some shells are smart enough to realize that either ^H or ^? should be treated as the backspace character, but some programs don't (like mail, vi...).

How do I:
How are we doing? Comments on this page?
Office of Information Technology
Office of Information Technology Help Desk Web Site University of Maryland Web Site Office of Information Technology Web Site