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 System-V-like UNIXes
23 and systems using that convention, getty does this job by setting TERM
24 according to the type 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.
62
63 -e Set the erase character to ch.
64
65 -I Do not send the terminal or tab initialization strings to the ter‐
66 minal.
67
68 -i Set the interrupt character to ch.
69
70 -k Set the line kill character to ch.
71
72 -m Specify a mapping from a port type to a terminal. See the section
73 TERMINAL TYPE MAPPING for more information.
74
75 -Q Do not display any values for the erase, interrupt and line kill
76 characters. Normally tset displays the values for control charac‐
77 ters which differ from the system's default values.
78
79 -q The terminal type is displayed to the standard output, and the
80 terminal is not initialized in any way. The option `-' by itself
81 is equivalent but archaic.
82
83 -r Print the terminal type to the standard error output.
84
85 -s Print the sequence of shell commands to initialize the environment
86 variable TERM to the standard output. See the section SETTING THE
87 ENVIRONMENT for details.
88
89 -V reports the version of ncurses which was used in this program, and
90 exits.
91
92 -w Resize the window to match the size deduced via setupterm. Nor‐
93 mally this has no effect, unless setupterm is not able to detect
94 the window size.
95
96 The arguments for the -e, -i, and -k options may either be entered as
97 actual characters or by using the `hat' notation, i.e., control-h may
98 be specified as ``^H'' or ``^h''.
99
101 It is often desirable to enter the terminal type and information about
102 the terminal's capabilities into the shell's environment. This is done
103 using the -s option.
104
105 When the -s option is specified, the commands to enter the information
106 into the shell's environment are written to the standard output. If
107 the SHELL environmental variable ends in ``csh'', the commands are for
108 csh, otherwise, they are for sh. Note, the csh commands set and unset
109 the shell variable noglob, leaving it unset. The following line in the
110 .login or .profile files will initialize the environment correctly:
111
112 eval `tset -s options ... `
113
115 When the terminal is not hardwired into the system (or the current sys‐
116 tem information is incorrect) the terminal type derived from the
117 /etc/ttys file or the TERM environmental variable is often something
118 generic like network, dialup, or unknown. When tset is used in a
119 startup script it is often desirable to provide information about the
120 type of terminal used on such ports.
121
122 The purpose of the -m option is to map from some set of conditions to a
123 terminal type, that is, to tell tset ``If I'm on this port at a partic‐
124 ular speed, guess that I'm on that kind of terminal''.
125
126 The argument to the -m option consists of an optional port type, an
127 optional operator, an optional baud rate specification, an optional
128 colon (``:'') character and a terminal type. The port type is a string
129 (delimited by either the operator or the colon character). The opera‐
130 tor may be any combination of ``>'', ``<'', ``@'', and ``!''; ``>''
131 means greater than, ``<'' means less than, ``@'' means equal to and
132 ``!'' inverts the sense of the test. The baud rate is specified as a
133 number and is compared with the speed of the standard error output
134 (which should be the control terminal). The terminal type is a string.
135
136 If the terminal type is not specified on the command line, the -m map‐
137 pings are applied to the terminal type. If the port type and baud rate
138 match the mapping, the terminal type specified in the mapping replaces
139 the current type. If more than one mapping is specified, the first
140 applicable mapping is used.
141
142 For example, consider the following mapping: dialup>9600:vt100. The
143 port type is dialup , the operator is >, the baud rate specification is
144 9600, and the terminal type is vt100. The result of this mapping is to
145 specify that if the terminal type is dialup, and the baud rate is
146 greater than 9600 baud, a terminal type of vt100 will be used.
147
148 If no baud rate is specified, the terminal type will match any baud
149 rate. If no port type is specified, the terminal type will match any
150 port type. For example, -m dialup:vt100 -m :?xterm will cause any
151 dialup port, regardless of baud rate, to match the terminal type vt100,
152 and any non-dialup port type to match the terminal type ?xterm. Note,
153 because of the leading question mark, the user will be queried on a
154 default port as to whether they are actually using an xterm terminal.
155
156 No whitespace characters are permitted in the -m option argument.
157 Also, to avoid problems with meta-characters, it is suggested that the
158 entire -m option argument be placed within single quote characters, and
159 that csh users insert a backslash character (``\'') before any exclama‐
160 tion marks (``!'').
161
163 The tset command appeared in BSD 3.0. The ncurses implementation was
164 lightly adapted from the 4.4BSD sources for a terminfo environment by
165 Eric S. Raymond <esr@snark.thyrsus.com>.
166
168 The tset utility has been provided for backward-compatibility with BSD
169 environments (under most modern UNIXes, /etc/inittab and getty(1) can
170 set TERM appropriately for each dial-up line; this obviates what was
171 tset's most important use). This implementation behaves like 4.4BSD
172 tset, with a few exceptions specified here.
173
174 The -S option of BSD tset no longer works; it prints an error message
175 to stderr and dies. The -s option only sets TERM, not TERMCAP. Both
176 these changes are because the TERMCAP variable is no longer supported
177 under terminfo-based ncurses, which makes tset -S useless (we made it
178 die noisily rather than silently induce lossage).
179
180 There was an undocumented 4.4BSD feature that invoking tset via a link
181 named `TSET` (or via any other name beginning with an upper-case let‐
182 ter) set the terminal to use upper-case only. This feature has been
183 omitted.
184
185 The -A, -E, -h, -u and -v options were deleted from the tset utility in
186 4.4BSD. None of them were documented in 4.3BSD and all are of limited
187 utility at best. The -a, -d, and -p options are similarly not docu‐
188 mented or useful, but were retained as they appear to be in widespread
189 use. It is strongly recommended that any usage of these three options
190 be changed to use the -m option instead. The -n option remains, but
191 has no effect. The -adnp options are therefore omitted from the usage
192 summary above.
193
194 It is still permissible to specify the -e, -i, and -k options without
195 arguments, although it is strongly recommended that such usage be fixed
196 to explicitly specify the character.
197
198 As of 4.4BSD, executing tset as reset no longer implies the -Q option.
199 Also, the interaction between the - option and the terminal argument in
200 some historic implementations of tset has been removed.
201
203 The tset command uses these environment variables:
204
205 SHELL
206 tells tset whether to initialize TERM using sh or csh syntax.
207
208 TERM Denotes your terminal type. Each terminal type is distinct,
209 though many are similar.
210
211 TERMCAP
212 may denote the location of a termcap database. If it is not an
213 absolute pathname, e.g., begins with a `/', tset removes the vari‐
214 able from the environment before looking for the terminal descrip‐
215 tion.
216
218 /etc/ttys
219 system port name to terminal type mapping database (BSD versions
220 only).
221
222 /usr/share/terminfo
223 terminal capability database
224
226 csh(1), sh(1), stty(1), curs_terminfo(3X), tty(4), terminfo(5),
227 ttys(5), environ(7)
228
229 This describes ncurses version 5.9 (patch 20130511).
230
231
232
233 tset(1)