4 <!-- Manpage converted by man2html 3.0.1 -->
8 <B>tset</B> - terminal initialization
12 <H2>SYNOPSIS</H2><PRE>
13 tset [-IQqrs] [-] [-e <I>ch</I>] [-i <I>ch</I>] [-k <I>ch</I>] [-m <I>mapping</I>]
15 reset [-IQqrs] [-] [-e <I>ch</I>] [-i <I>ch</I>] [-k <I>ch</I>] [-m <I>mapping</I>]
20 <H2>DESCRIPTION</H2><PRE>
21 <B>Tset</B> initializes terminals. <B>Tset</B> first determines the
22 type of terminal that you are using. This determination
23 is done as follows, using the first terminal type found.
25 1. The <B>terminal</B> argument specified on the command line.
27 2. The value of the <B>TERM</B> environmental variable.
29 3. (BSD systems only.) The terminal type associated with
30 the standard error output device in the <I>/etc/ttys</I> file.
31 (On Linux and System-V-like UNIXes, <I>getty</I> does this job by
32 setting <B>TERM</B> according to the type passed to it by
35 4. The default terminal type, ``unknown''.
37 If the terminal type was not specified on the command-
38 line, the -m option mappings are then applied (see below
39 for more information). Then, if the terminal type begins
40 with a question mark (``?''), the user is prompted for
41 confirmation of the terminal type. An empty response con-
42 firms the type, or, another type can be entered to specify
43 a new type. Once the terminal type has been determined,
44 the terminfo entry for the terminal is retrieved. If no
45 terminfo entry is found for the type, the user is prompted
46 for another terminal type.
48 Once the terminfo entry is retrieved, the window size,
49 backspace, interrupt and line kill characters (among many
50 other things) are set and the terminal and tab initializa-
51 tion strings are sent to the standard error output.
52 Finally, if the erase, interrupt and line kill characters
53 have changed, or are not set to their default values,
54 their values are displayed to the standard error output.
56 When invoked as <B>reset</B>, <B>tset</B> sets cooked and echo modes,
57 turns off cbreak and raw modes, turns on newline transla-
58 tion and resets any unset special characters to their
59 default values before doing the terminal initialization
60 described above. This is useful after a program dies
61 leaving a terminal in an abnormal state. Note, you may
64 <B><LF>reset<LF></B>
66 (the line-feed character is normally control-J) to get the
67 terminal to work, as carriage-return may no longer work in
68 the abnormal state. Also, the terminal will often not
71 The options are as follows:
73 -q The terminal type is displayed to the standard out-
74 put, and the terminal is not initialized in any way.
75 The option `-' by itself is equivalent but archaic.
77 -e Set the erase character to <I>ch</I>.
79 -I Do not send the terminal or tab initialization
80 strings to the terminal.
82 -i Set the interrupt character to <I>ch</I>.
84 -k Set the line kill character to <I>ch</I>.
86 -m Specify a mapping from a port type to a terminal.
87 See below for more information.
89 -Q Don't display any values for the erase, interrupt and
92 -r Print the terminal type to the standard error output.
94 -s Print the sequence of shell commands to initialize
95 the environment variable <B>TERM</B> to the standard output.
96 See the section below on setting the environment for
99 The arguments for the -e, -i, and -k options may either be
100 entered as actual characters or by using the `hat' nota-
101 tion, i.e. control-h may be specified as ``^H'' or ``^h''.
105 <H2>SETTING THE ENVIRONMENT</H2><PRE>
106 It is often desirable to enter the terminal type and
107 information about the terminal's capabilities into the
108 shell's environment. This is done using the -s option.
110 When the -s option is specified, the commands to enter the
111 information into the shell's environment are written to
112 the standard output. If the <B>SHELL</B> environmental variable
113 ends in ``csh'', the commands are for <B>csh</B>, otherwise, they
114 are for <B>sh</B>. Note, the <B>csh</B> commands set and unset the
115 shell variable <B>noglob</B>, leaving it unset. The following
116 line in the <B>.login</B> or <B>.profile</B> files will initialize the
117 environment correctly:
119 eval `tset -s options ... `
124 <H2>TERMINAL TYPE MAPPING</H2><PRE>
125 When the terminal is not hardwired into the system (or the
126 current system information is incorrect) the terminal type
127 derived from the <I>/etc/ttys</I> file or the <B>TERM</B> environmental
128 variable is often something generic like <B>network</B>, <B>dialup</B>,
129 or <B>unknown</B>. When <B>tset</B> is used in a startup script it is
130 often desirable to provide information about the type of
131 terminal used on such ports.
133 The purpose of the -m option is to map from some set of
134 conditions to a terminal type, that is, to tell <B>tset</B> ``If
135 I'm on this port at a particular speed, guess that I'm on
136 that kind of terminal''.
138 The argument to the -m option consists of an optional port
139 type, an optional operator, an optional baud rate specifi-
140 cation, an optional colon (``:'') character and a terminal
141 type. The port type is a string (delimited by either the
142 operator or the colon character). The operator may be any
143 combination of ``>'', ``<'', ``@'', and ``!''; ``>'' means
144 greater than, ``<'' means less than, ``@'' means equal to
145 and ``!'' inverts the sense of the test. The baud rate is
146 specified as a number and is compared with the speed of
147 the standard error output (which should be the control
148 terminal). The terminal type is a string.
150 If the terminal type is not specified on the command line,
151 the -m mappings are applied to the terminal type. If the
152 port type and baud rate match the mapping, the terminal
153 type specified in the mapping replaces the current type.
154 If more than one mapping is specified, the first applica-
157 For example, consider the following mapping:
158 <B>dialup>9600:vt100</B>. The port type is dialup , the operator
159 is >, the baud rate specification is 9600, and the termi-
160 nal type is vt100. The result of this mapping is to spec-
161 ify that if the terminal type is <B>dialup</B>, and the baud rate
162 is greater than 9600 baud, a terminal type of <B>vt100</B> will
165 If no baud rate is specified, the terminal type will match
166 any baud rate. If no port type is specified, the terminal
167 type will match any port type. For example, <B>-m</B>
168 <B>dialup:vt100</B> <B>-m</B> <B>:?xterm</B> will cause any dialup port,
169 regardless of baud rate, to match the terminal type vt100,
170 and any non-dialup port type to match the terminal type
171 ?xterm. Note, because of the leading question mark, the
172 user will be queried on a default port as to whether they
173 are actually using an xterm terminal.
175 No whitespace characters are permitted in the -m option
176 argument. Also, to avoid problems with meta-characters,
177 it is suggested that the entire -m option argument be
178 placed within single quote characters, and that <B>csh</B> users
179 insert a backslash character (``\'') before any exclama-
184 <H2>HISTORY</H2><PRE>
185 The <B>tset</B> command appeared in BSD 3.0. The <B>ncurses</B> imple-
186 mentation was lightly adapted from the 4.4BSD sources for
187 a terminfo environment by Eric S. Raymond <esr@snark.thyr-
192 <H2>COMPATIBILITY</H2><PRE>
193 The <B>tset</B> utility has been provided for backward-compati-
194 bility with BSD environments (under most modern UNIXes,
195 <B>/etc/inittab</B> and <B><A HREF="getty.1.html">getty(1)</A></B> can set <B>TERM</B> appropriately for
196 each dial-up line; this obviates what was <B>tset</B>'s most
197 important use). This implementation behaves like 4.4BSD
198 tset, with a few exceptions specified here.
200 The -S option of BSD tset no longer works; it prints an
201 error message to stderr and dies. The -s option only sets
202 <B>TERM</B>, not <B>TERMCAP</B>. Both these changes are because the
203 <B>TERMCAP</B> variable is no longer supported under terminfo-
204 based <B>ncurses</B>, which makes <B>tset</B> <B>-S</B> useless (we made it die
205 noisily rather than silently induce lossage).
207 There was an undocumented 4.4BSD feature that invoking
208 tset via a link named `TSET` (or via any other name begin-
209 ning with an upper-case letter) set the terminal to use
210 upper-case only. This feature has been omitted.
212 The -A, -E, -h, -u and -v options were deleted from the
213 <B>tset</B> utility in 4.4BSD. None of them were documented in
214 4.3BSD and all are of limited utility at best. The -a, -d,
215 and -p options are similarly not documented or useful, but
216 were retained as they appear to be in widespread use. It
217 is strongly recommended that any usage of these three
218 options be changed to use the -m option instead. The -n
219 option remains, but has no effect. The -adnp options are
220 therefore omitted from the usage summary above.
222 It is still permissible to specify the -e, -i, and -k
223 options without arguments, although it is strongly recom-
224 mended that such usage be fixed to explicitly specify the
227 As of 4.4BSD, executing <B>tset</B> as <B>reset</B> no longer implies
228 the -Q option. Also, the interaction between the - option
229 and the <I>terminal</I> argument in some historic implementations
230 of <B>tset</B> has been removed.
234 <H2>ENVIRONMENT</H2><PRE>
235 The <B>tset</B> command uses the <B>SHELL</B> and <B>TERM</B> environment vari-
242 system port name to terminal type mapping database
246 terminal capability database
250 <H2>SEE ALSO</H2><PRE>
251 <B><A HREF="csh.1.html">csh(1)</A></B>, <B><A HREF="sh.1.html">sh(1)</A></B>, <B><A HREF="stty.1.html">stty(1)</A></B>, <B><A HREF="tty.4.html">tty(4)</A></B>, <B><A HREF="termcap.5.html">termcap(5)</A></B>, <B><A HREF="ttys.5.html">ttys(5)</A></B>, envi-
252 <B><A HREF="ron.7.html">ron(7)</A></B>
299 Man(1) output converted with
300 <a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>