tset, reset - terminal initialization


tset [-IQrs] [-] [-e ch] [-i ch] [-k ch]
	 [-m mapping] [terminal]
reset [-IQrs] [-] [-e ch] [-i ch] [-k ch]
	[-m mapping] [terminal]


The tset(1) utility initializes terminals. The tset(1) utility first determines the type of terminal you are using. It makes this determination according to the following criteria, using the first terminal type found:

  1. The terminal argument specified on the command line.
  2. The value of the TERM environment variable.
  3. The default terminal type, "unknown".

If the terminal type was not specified on the command-line, the -m option mappings are applied (see below for more information). Then, if the terminal type begins with a question mark ("?"), the user is prompted for confirmation of the terminal type. An empty response confirms the type, or, another type can be entered to specify a new type. Once the terminal type has been determined, the terminfo entry for the terminal is retrieved. If no terminfo entry is found for the type, the user is prompted for another terminal type.

After the terminfo entry is retrieved, the window-size, back-space, interrupt and line-kill characters (among many other things) are set, and the terminal and tab initialization strings are sent to the standard error output. Finally, if the erase, interrupt and line-kill characters have changed or are not set to their default values, their values are displayed to the standard error output.

The tset(1) command can also be installed as reset(1). When invoked as reset(1), tset(1) sets cooked and echo modes, turns off cbreak and raw modes, turns on newline translation and resets any unset special characters to their default values before doing the terminal initialization described previously. This is useful after a program dies and leaves a terminal in an abnormal state. Note: you might have to type


(the line-feed character is normally CTRL+J) to get the terminal to work, as carriage return might not work in the abnormal state. Also, the terminal will often not echo the command.

The options are as follows:

The terminal type is displayed to the standard output, and the terminal is not initialized in any way.
-e ch
Set the erase character to ch.
Do not send the terminal or tab-initialization strings to the terminal.
-i ch
Set the interrupt character to ch.
-k ch
Set the line kill character to ch.
Specify a mapping from a port type to a terminal. This is discussed later in this topic.
Do not display any values for the erase, interrupt, and line-kill characters.
Print the terminal type to the standard error output.
Print the sequence of shell commands to initialize the environment variable TERM to the standard output. See the section on setting the environment for details.

The arguments for the -e, -i, and -k options might either be entered as actual characters or by using the 'hat' notation; CTRL+h might be specified as "^H" or "^h".


It is often desirable to enter the terminal type and information about the terminal's capabilities into the shell's environment. This is done using the -s option.

When the -s option is specified, the commands to enter the information into the shell's environment are written to the standard output. If the SHELL environment variable ends in "csh", the commands are for csh(1); otherwise, they are for sh(1). Note that the csh(1) commands set and unset the shell variable noglob, leaving it unset. The following line in the .login or .profile files will initialize the environment correctly:

eval 'tset -s options ... '


When the terminal is not hardwired into the system (or the current system information is incorrect) the terminal type derived from the TERM environment variable is often something generic, like network, dialup, or unknown. When tset(1) is used in a startup script, it is often desirable to provide information about the type of terminal used on such ports.

The purpose of the -m option is to map from some set of conditions to a terminal type; that is, to tell tset(1) that if you are on this port at a particular speed, it should guess that you are on that kind of terminal.

The argument to the -m option consists of an optional port type, an optional operator, an optional baud rate specification, an optional colon (":") character and a terminal type. The port type is a string (delimited by either the operator or the colon character). The operator can be any combination of ">", "<", "@", and "!"; ">" means greater than, "<" means less than, "@" means equal to and "!" inverts the sense of the test. The baud rate is specified as a number and is compared with the speed of the standard error output (which should be the control terminal). The terminal type is a string.

If the terminal type is not specified on the command line, the -m mappings are applied to the terminal type. If the port type and baud rate match the mapping, the terminal type specified in the mapping replaces the current type. If more than one mapping is specified, the first applicable mapping is used.

For example, consider the following mapping: dialup>9600:vt100. The port type is dialup, the operator is >, the baud-rate specification is 9600, and the terminal type is vt100. The result of this mapping is to specify that if the terminal type is dialup, and the baud rate is greater than 9600 baud, a terminal type of vt100 will be used.

If no baud rate is specified, the terminal type will match any baud rate. If no port type is specified, the terminal type will match any port type. For example, -m dialup:vt100 -m :?xterm will cause any dial-up port, regardless of baud rate, to match the terminal type vt100, and any non-dialup port type to match the terminal type ?xterm. Note, that because of the leading question mark, the user will be queried on a default port as to whether they are actually using an xterm terminal.

No white-space characters are permitted in the -m option argument. Also, to avoid problems with metacharacters, it is suggested that the entire -m option argument be placed within single quote characters, and that csh(1) users insert a backslash character ("\") before any exclamation marks ("!").


The ncurses implementation was lightly adapted from the 4.4BSD sources for a terminfo environment by Eric S. Raymond <esr@snark.thyrsus.com>.

The tset(1) utility has been provided for backward compatibility with Berkeley Software Distribution (BSD) environments. This implementation behaves like 4.4BSD tset(1), with a few exceptions specified here.

There was an undocumented 4.4BSD feature that invoking tset(1) through a link named 'TSET' (or through any other name beginning with an uppercase letter) set the terminal to use uppercase only. This feature has been omitted.

The -A, -E, -h, -u, and -v options were deleted from the tset(1) utility in 4.4BSD. None of them were documented in 4.3BSD, and all are of limited utility at best. The -a, -d, and -p options are similarly not documented or useful, but were retained because they appear to be widely used. It is strongly recommended that any usage of these three options be changed to use the -m option instead. The -n option remains, but has no effect. The -adnp options are therefore omitted from the usage summary.

It is still permissible to specify the -e, -i, and -k options without arguments, although it is strongly recommended that such usage be fixed to explicitly specify the character.

As of 4.4BSD, executing tset(1) as reset(1) no longer implies the -Q option. Also, the interaction between the - option and the terminal argument in some historic implementations of tset(1) has been removed.


The tset(1) command uses the SHELL and TERM environment variables.


Terminal capability database.


The default installation does not install the tset(1) command as reset(1). Use the ln(1) command (if Interix is installed on an NTFS file system partition), or the cp(1) command to create reset(1).