5.11 Initializing the Terminal with tset
As you log in, especially if you're using a terminal that's shared with other users, it's a good idea to initialize your terminal (reset it to its default state). If your system has termcap , use tset (5.3 ) . On systems with terminfo , use tput (5.12 ) .
In fact, despite its role in terminal type setting, you might say that the "proper" function of tset is to initialize the terminal. It outputs an initialization string (if one is defined in the terminal's termcap entry), which should set the terminal to a reasonable state. In this role, it overlaps somewhat with stty (41.3 , 5.9 ) , setting the erase and kill characters to CTRL-h and CTRL-x. (Options allow the user to specify alternate values for these characters, as well as for the interrupt character.) When done, it prints the following message:
Erase is control-H Kill is control-X
(or whatever else you have set these characters to). This message can be suppressed by adding the -Q (quiet) option.
A special form of the tset command, called reset , is found on some systems. In addition to tset 's normal processing, it sets various stty modes to what it considers a "reasonable" state . (42.4 , 42.2 ) It can thus be used to reset both the terminal and the serial line control parameters in cases where a bombing program or user bungling has left the terminal in an unusable state.
There are some cases in which normal end-of-line processing has been disabled, and the system will no longer perform the carriage return to linefeed translation UNIX requires to work with most terminals. In these cases, you may need to type:
to get reset to work.
- from O'Reilly & Associates' termcap & terminfo , Chapter 4