1tset(1) General Commands Manual tset(1)
2
3
4
6 tset, reset - terminal initialization
7
9 tset [-IQVcqrsw] [-] [-e ch] [-i ch] [-k ch] [-m mapping] [terminal]
10 reset [-IQVcqrsw] [-] [-e ch] [-i ch] [-k ch] [-m mapping] [terminal]
11
13 Tset initializes terminals. Tset first determines the type of terminal
14 that you are using. This determination is done as follows, using the
15 first terminal type found.
16
17 1. The terminal argument specified on the command line.
18
19 2. The value of the TERM environmental variable.
20
21 3. (BSD systems only.) The terminal type associated with the standard
22 error output device in the /etc/ttys file. (On Linux and System-V-like
23 UNIXes, getty does this job by setting TERM according to the type
24 passed to it by /etc/inittab.)
25
26 4. The default terminal type, ``unknown''.
27
28 If the terminal type was not specified on the command-line, the -m
29 option mappings are then applied (see the section TERMINAL TYPE MAPPING
30 for more information). Then, if the terminal type begins with a ques‐
31 tion mark (``?''), the user is prompted for confirmation of the termi‐
32 nal type. An empty response confirms the type, or, another type can be
33 entered to specify a new type. Once the terminal type has been deter‐
34 mined, the terminfo entry for the terminal is retrieved. If no ter‐
35 minfo entry is found for the type, the user is prompted for another
36 terminal type.
37
38 Once the terminfo entry is retrieved, the window size, backspace,
39 interrupt and line kill characters (among many other things) are set
40 and the terminal and tab initialization strings are sent to the stan‐
41 dard error output. Finally, if the erase, interrupt and line kill
42 characters have changed, or are not set to their default values, their
43 values are displayed to the standard error output. Use the -c or -w
44 option to select only the window sizing versus the other initializa‐
45 tion. If neither option is given, both are assumed.
46
47 When invoked as reset, tset sets cooked and echo modes, turns off
48 cbreak and raw modes, turns on newline translation and resets any unset
49 special characters to their default values before doing the terminal
50 initialization described above. This is useful after a program dies
51 leaving a terminal in an abnormal state. Note, you may have to type
52
53 <LF>reset<LF>
54
55 (the line-feed character is normally control-J) to get the terminal to
56 work, as carriage-return may no longer work in the abnormal state.
57 Also, the terminal will often not echo the command.
58
59 The options are as follows:
60
61 -c Set control characters and modes. -e Set the erase character to
62 ch.
63
64 -I Do not send the terminal or tab initialization strings to the ter‐
65 minal.
66
67 -i Set the interrupt character to ch.
68
69 -k Set the line kill character to ch.
70
71 -m Specify a mapping from a port type to a terminal. See the section
72 TERMINAL TYPE MAPPING for more information.
73
74 -Q Do not display any values for the erase, interrupt and line kill
75 characters. Normally tset displays the values for control charac‐
76 ters which differ from the system's default values.
77
78 -q The terminal type is displayed to the standard output, and the
79 terminal is not initialized in any way. The option `-' by itself
80 is equivalent but archaic.
81
82 -r Print the terminal type to the standard error output.
83
84 -s Print the sequence of shell commands to initialize the environment
85 variable TERM to the standard output. See the section SETTING THE
86 ENVIRONMENT for details.
87
88 -V reports the version of ncurses which was used in this program, and
89 exits.
90
91 -w Resize the window to match the size deduced via setupterm. Nor‐
92 mally this has no effect, unless setupterm is not able to detect
93 the window size.
94
95 The arguments for the -e, -i, and -k options may either be entered as
96 actual characters or by using the `hat' notation, i.e. control-h may be
97 specified as ``^H'' or ``^h''.
98
100 It is often desirable to enter the terminal type and information about
101 the terminal's capabilities into the shell's environment. This is done
102 using the -s option.
103
104 When the -s option is specified, the commands to enter the information
105 into the shell's environment are written to the standard output. If
106 the SHELL environmental variable ends in ``csh'', the commands are for
107 csh, otherwise, they are for sh. Note, the csh commands set and unset
108 the shell variable noglob, leaving it unset. The following line in the
109 .login or .profile files will initialize the environment correctly:
110
111 eval `tset -s options ... `
112
114 When the terminal is not hardwired into the system (or the current sys‐
115 tem information is incorrect) the terminal type derived from the
116 /etc/ttys file or the TERM environmental variable is often something
117 generic like network, dialup, or unknown. When tset is used in a
118 startup script it is often desirable to provide information about the
119 type of terminal used on such ports.
120
121 The purpose of the -m option is to map from some set of conditions to a
122 terminal type, that is, to tell tset ``If I'm on this port at a partic‐
123 ular speed, guess that I'm on that kind of terminal''.
124
125 The argument to the -m option consists of an optional port type, an
126 optional operator, an optional baud rate specification, an optional
127 colon (``:'') character and a terminal type. The port type is a string
128 (delimited by either the operator or the colon character). The opera‐
129 tor may be any combination of ``>'', ``<'', ``@'', and ``!''; ``>''
130 means greater than, ``<'' means less than, ``@'' means equal to and
131 ``!'' inverts the sense of the test. The baud rate is specified as a
132 number and is compared with the speed of the standard error output
133 (which should be the control terminal). The terminal type is a string.
134
135 If the terminal type is not specified on the command line, the -m map‐
136 pings are applied to the terminal type. If the port type and baud rate
137 match the mapping, the terminal type specified in the mapping replaces
138 the current type. If more than one mapping is specified, the first
139 applicable mapping is used.
140
141 For example, consider the following mapping: dialup>9600:vt100. The
142 port type is dialup , the operator is >, the baud rate specification is
143 9600, and the terminal type is vt100. The result of this mapping is to
144 specify that if the terminal type is dialup, and the baud rate is
145 greater than 9600 baud, a terminal type of vt100 will be used.
146
147 If no baud rate is specified, the terminal type will match any baud
148 rate. If no port type is specified, the terminal type will match any
149 port type. For example, -m dialup:vt100 -m :?xterm will cause any
150 dialup port, regardless of baud rate, to match the terminal type vt100,
151 and any non-dialup port type to match the terminal type ?xterm. Note,
152 because of the leading question mark, the user will be queried on a
153 default port as to whether they are actually using an xterm terminal.
154
155 No whitespace characters are permitted in the -m option argument.
156 Also, to avoid problems with meta-characters, it is suggested that the
157 entire -m option argument be placed within single quote characters, and
158 that csh users insert a backslash character (``\'') before any exclama‐
159 tion marks (``!'').
160
162 The tset command appeared in BSD 3.0. The ncurses implementation was
163 lightly adapted from the 4.4BSD sources for a terminfo environment by
164 Eric S. Raymond <esr@snark.thyrsus.com>.
165
167 The tset utility has been provided for backward-compatibility with BSD
168 environments (under most modern UNIXes, /etc/inittab and getty(1) can
169 set TERM appropriately for each dial-up line; this obviates what was
170 tset's most important use). This implementation behaves like 4.4BSD
171 tset, with a few exceptions specified here.
172
173 The -S option of BSD tset no longer works; it prints an error message
174 to stderr and dies. The -s option only sets TERM, not TERMCAP. Both
175 these changes are because the TERMCAP variable is no longer supported
176 under terminfo-based ncurses, which makes tset -S useless (we made it
177 die noisily rather than silently induce lossage).
178
179 There was an undocumented 4.4BSD feature that invoking tset via a link
180 named `TSET` (or via any other name beginning with an upper-case let‐
181 ter) set the terminal to use upper-case only. This feature has been
182 omitted.
183
184 The -A, -E, -h, -u and -v options were deleted from the tset utility in
185 4.4BSD. None of them were documented in 4.3BSD and all are of limited
186 utility at best. The -a, -d, and -p options are similarly not docu‐
187 mented or useful, but were retained as they appear to be in widespread
188 use. It is strongly recommended that any usage of these three options
189 be changed to use the -m option instead. The -n option remains, but
190 has no effect. The -adnp options are therefore omitted from the usage
191 summary above.
192
193 It is still permissible to specify the -e, -i, and -k options without
194 arguments, although it is strongly recommended that such usage be fixed
195 to explicitly specify the character.
196
197 As of 4.4BSD, executing tset as reset no longer implies the -Q option.
198 Also, the interaction between the - option and the terminal argument in
199 some historic implementations of tset has been removed.
200
202 The tset command uses these environment variables:
203
204 SHELL
205 tells tset whether to initialize TERM using sh or csh syntax.
206
207 TERM Denotes your terminal type. Each terminal type is distinct,
208 though many are similar.
209
210 TERMCAP
211 may denote the location of a termcap database. If it is not an
212 absolute pathname, e.g., begins with a `/', tset removes the vari‐
213 able from the environment before looking for the terminal descrip‐
214 tion.
215
217 /etc/ttys
218 system port name to terminal type mapping database (BSD versions
219 only).
220
221 /usr/share/terminfo
222 terminal capability database
223
225 csh(1), sh(1), stty(1), curs_terminfo(3X), tty(4), terminfo(5),
226 ttys(5), environ(7)
227
228 This describes ncurses version 5.6 (patch 20070812).
229
230
231
232 tset(1)