2 ****************************************************************************
3 * Copyright (c) 1998-2017,2018 Free Software Foundation, Inc. *
5 * Permission is hereby granted, free of charge, to any person obtaining a *
6 * copy of this software and associated documentation files (the *
7 * "Software"), to deal in the Software without restriction, including *
8 * without limitation the rights to use, copy, modify, merge, publish, *
9 * distribute, distribute with modifications, sublicense, and/or sell *
10 * copies of the Software, and to permit persons to whom the Software is *
11 * furnished to do so, subject to the following conditions: *
13 * The above copyright notice and this permission notice shall be included *
14 * in all copies or substantial portions of the Software. *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
19 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
20 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
21 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
22 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
24 * Except as contained in this notice, the name(s) of the above copyright *
25 * holders shall not be used in advertising or otherwise to promote the *
26 * sale, use or other dealings in this Software without prior written *
28 ****************************************************************************
29 * @Id: tset.1,v 1.54 2018/07/28 21:30:27 tom Exp @
31 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
34 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
35 <meta name="generator" content="Manpage converted by man2html - see https://invisible-island.net/scripts/readme.html#others_scripts">
37 <link rel="author" href="mailto:bug-ncurses@gnu.org">
38 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
41 <H1 class="no-header">tset 1</H1>
43 <STRONG><A HREF="tset.1.html">tset(1)</A></STRONG> General Commands Manual <STRONG><A HREF="tset.1.html">tset(1)</A></STRONG>
48 </PRE><H2><a name="h2-NAME">NAME</a></H2><PRE>
49 <STRONG>tset</STRONG>, <STRONG>reset</STRONG> - terminal initialization
52 </PRE><H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE>
53 <STRONG>tset</STRONG> [<STRONG>-IQVcqrsw</STRONG>] [<STRONG>-</STRONG>] [<STRONG>-e</STRONG> <EM>ch</EM>] [<STRONG>-i</STRONG> <EM>ch</EM>] [<STRONG>-k</STRONG> <EM>ch</EM>] [<STRONG>-m</STRONG> <EM>mapping</EM>] [<EM>terminal</EM>]
54 <STRONG>reset</STRONG> [<STRONG>-IQVcqrsw</STRONG>] [<STRONG>-</STRONG>] [<STRONG>-e</STRONG> <EM>ch</EM>] [<STRONG>-i</STRONG> <EM>ch</EM>] [<STRONG>-k</STRONG> <EM>ch</EM>] [<STRONG>-m</STRONG> <EM>mapping</EM>] [<EM>terminal</EM>]
57 </PRE><H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
59 </PRE><H3><a name="h3-tset---initialization">tset - initialization</a></H3><PRE>
60 This program initializes terminals.
62 First, <STRONG>tset</STRONG> retrieves the current terminal mode settings for your ter-
63 minal. It does this by successively testing
65 <STRONG>o</STRONG> the standard error,
67 <STRONG>o</STRONG> standard output,
69 <STRONG>o</STRONG> standard input and
71 <STRONG>o</STRONG> ultimately "/dev/tty"
73 to obtain terminal settings. Having retrieved these settings, <STRONG>tset</STRONG>
74 remembers which file descriptor to use when updating settings.
76 Next, <STRONG>tset</STRONG> determines the type of terminal that you are using. This
77 determination is done as follows, using the first terminal type found.
79 1. The <STRONG>terminal</STRONG> argument specified on the command line.
81 2. The value of the <STRONG>TERM</STRONG> environmental variable.
83 3. (BSD systems only.) The terminal type associated with the standard
84 error output device in the <EM>/etc/ttys</EM> file. (On System-V-like UNIXes
85 and systems using that convention, <EM>getty</EM> does this job by setting <STRONG>TERM</STRONG>
86 according to the type passed to it by <EM>/etc/inittab</EM>.)
88 4. The default terminal type, "unknown".
90 If the terminal type was not specified on the command-line, the <STRONG>-m</STRONG>
91 option mappings are then applied (see the section <STRONG>TERMINAL</STRONG> <STRONG>TYPE</STRONG> <STRONG>MAPPING</STRONG>
92 for more information). Then, if the terminal type begins with a ques-
93 tion mark ("?"), the user is prompted for confirmation of the terminal
94 type. An empty response confirms the type, or, another type can be
95 entered to specify a new type. Once the terminal type has been deter-
96 mined, the terminal description for the terminal is retrieved. If no
97 terminal description is found for the type, the user is prompted for
98 another terminal type.
100 Once the terminal description is retrieved,
102 <STRONG>o</STRONG> if the "<STRONG>-w</STRONG>" option is enabled, <STRONG>tset</STRONG> may update the terminal's win-
105 If the window size cannot be obtained from the operating system,
106 but the terminal description (or environment, e.g., <STRONG>LINES</STRONG> and <STRONG>COL-</STRONG>
107 <STRONG>UMNS</STRONG> variables specify this), use this to set the operating sys-
108 tem's notion of the window size.
110 <STRONG>o</STRONG> if the "<STRONG>-c</STRONG>" option is enabled, the backspace, interrupt and line
111 kill characters (among many other things) are set
113 <STRONG>o</STRONG> unless the "<STRONG>-I</STRONG>" option is enabled, the terminal and tab <EM>initializa-</EM>
114 <EM>tion</EM> strings are sent to the standard error output, and <STRONG>tset</STRONG> waits
115 one second (in case a hardware reset was issued).
117 <STRONG>o</STRONG> Finally, if the erase, interrupt and line kill characters have
118 changed, or are not set to their default values, their values are
119 displayed to the standard error output.
122 </PRE><H3><a name="h3-reset---reinitialization">reset - reinitialization</a></H3><PRE>
123 When invoked as <STRONG>reset</STRONG>, <STRONG>tset</STRONG> sets the terminal modes to "sane" values:
125 <STRONG>o</STRONG> sets cooked and echo modes,
127 <STRONG>o</STRONG> turns off cbreak and raw modes,
129 <STRONG>o</STRONG> turns on newline translation and
131 <STRONG>o</STRONG> resets any unset special characters to their default values
133 before doing the terminal initialization described above. Also, rather
134 than using the terminal <EM>initialization</EM> strings, it uses the terminal
135 <EM>reset</EM> strings.
137 The <STRONG>reset</STRONG> command is useful after a program dies leaving a terminal in
140 <STRONG>o</STRONG> you may have to type
142 <EM><LF></EM><STRONG>reset</STRONG><EM><LF></EM>
144 (the line-feed character is normally control-J) to get the terminal
145 to work, as carriage-return may no longer work in the abnormal
148 <STRONG>o</STRONG> Also, the terminal will often not echo the command.
151 </PRE><H2><a name="h2-OPTIONS">OPTIONS</a></H2><PRE>
152 The options are as follows:
154 <STRONG>-c</STRONG> Set control characters and modes.
156 <STRONG>-e</STRONG> Set the erase character to <EM>ch</EM>.
158 <STRONG>-I</STRONG> Do not send the terminal or tab initialization strings to the ter-
161 <STRONG>-i</STRONG> Set the interrupt character to <EM>ch</EM>.
163 <STRONG>-k</STRONG> Set the line kill character to <EM>ch</EM>.
165 <STRONG>-m</STRONG> Specify a mapping from a port type to a terminal. See the section
166 <STRONG>TERMINAL</STRONG> <STRONG>TYPE</STRONG> <STRONG>MAPPING</STRONG> for more information.
168 <STRONG>-Q</STRONG> Do not display any values for the erase, interrupt and line kill
169 characters. Normally <STRONG>tset</STRONG> displays the values for control charac-
170 ters which differ from the system's default values.
172 <STRONG>-q</STRONG> The terminal type is displayed to the standard output, and the
173 terminal is not initialized in any way. The option "-" by itself
174 is equivalent but archaic.
176 <STRONG>-r</STRONG> Print the terminal type to the standard error output.
178 <STRONG>-s</STRONG> Print the sequence of shell commands to initialize the environment
179 variable <STRONG>TERM</STRONG> to the standard output. See the section <STRONG>SETTING</STRONG> <STRONG>THE</STRONG>
180 <STRONG>ENVIRONMENT</STRONG> for details.
182 <STRONG>-V</STRONG> reports the version of ncurses which was used in this program, and
185 <STRONG>-w</STRONG> Resize the window to match the size deduced via <STRONG><A HREF="curs_terminfo.3x.html">setupterm(3x)</A></STRONG>.
186 Normally this has no effect, unless <STRONG>setupterm</STRONG> is not able to
187 detect the window size.
189 The arguments for the <STRONG>-e</STRONG>, <STRONG>-i</STRONG>, and <STRONG>-k</STRONG> options may either be entered as
190 actual characters or by using the "hat" notation, i.e., control-h may
191 be specified as "^H" or "^h".
193 If neither <STRONG>-c</STRONG> or <STRONG>-w</STRONG> is given, both options are assumed.
196 </PRE><H2><a name="h2-SETTING-THE-ENVIRONMENT">SETTING THE ENVIRONMENT</a></H2><PRE>
197 It is often desirable to enter the terminal type and information about
198 the terminal's capabilities into the shell's environment. This is done
199 using the <STRONG>-s</STRONG> option.
201 When the <STRONG>-s</STRONG> option is specified, the commands to enter the information
202 into the shell's environment are written to the standard output. If
203 the <STRONG>SHELL</STRONG> environmental variable ends in "csh", the commands are for
204 <STRONG>csh</STRONG>, otherwise, they are for <STRONG>sh</STRONG>. Note, the <STRONG>csh</STRONG> commands set and unset
205 the shell variable <STRONG>noglob</STRONG>, leaving it unset. The following line in the
206 <STRONG>.login</STRONG> or <STRONG>.profile</STRONG> files will initialize the environment correctly:
208 eval `tset -s options ... `
211 </PRE><H2><a name="h2-TERMINAL-TYPE-MAPPING">TERMINAL TYPE MAPPING</a></H2><PRE>
212 When the terminal is not hardwired into the system (or the current sys-
213 tem information is incorrect) the terminal type derived from the
214 <EM>/etc/ttys</EM> file or the <STRONG>TERM</STRONG> environmental variable is often something
215 generic like <STRONG>network</STRONG>, <STRONG>dialup</STRONG>, or <STRONG>unknown</STRONG>. When <STRONG>tset</STRONG> is used in a
216 startup script it is often desirable to provide information about the
217 type of terminal used on such ports.
219 The <STRONG>-m</STRONG> options maps from some set of conditions to a terminal type,
220 that is, to tell <STRONG>tset</STRONG> "If I'm on this port at a particular speed, guess
221 that I'm on that kind of terminal".
223 The argument to the <STRONG>-m</STRONG> option consists of an optional port type, an
224 optional operator, an optional baud rate specification, an optional
225 colon (":") character and a terminal type. The port type is a string
226 (delimited by either the operator or the colon character). The opera-
227 tor may be any combination of ">", "<", "@", and "!"; ">" means greater
228 than, "<" means less than, "@" means equal to and "!" inverts the sense
229 of the test. The baud rate is specified as a number and is compared
230 with the speed of the standard error output (which should be the con-
231 trol terminal). The terminal type is a string.
233 If the terminal type is not specified on the command line, the <STRONG>-m</STRONG> map-
234 pings are applied to the terminal type. If the port type and baud rate
235 match the mapping, the terminal type specified in the mapping replaces
236 the current type. If more than one mapping is specified, the first
237 applicable mapping is used.
239 For example, consider the following mapping: <STRONG>dialup>9600:vt100</STRONG>. The
240 port type is dialup , the operator is >, the baud rate specification is
241 9600, and the terminal type is vt100. The result of this mapping is to
242 specify that if the terminal type is <STRONG>dialup</STRONG>, and the baud rate is
243 greater than 9600 baud, a terminal type of <STRONG>vt100</STRONG> will be used.
245 If no baud rate is specified, the terminal type will match any baud
246 rate. If no port type is specified, the terminal type will match any
247 port type. For example, <STRONG>-m</STRONG> <STRONG>dialup:vt100</STRONG> <STRONG>-m</STRONG> <STRONG>:?xterm</STRONG> will cause any
248 dialup port, regardless of baud rate, to match the terminal type vt100,
249 and any non-dialup port type to match the terminal type ?xterm. Note,
250 because of the leading question mark, the user will be queried on a
251 default port as to whether they are actually using an xterm terminal.
253 No whitespace characters are permitted in the <STRONG>-m</STRONG> option argument.
254 Also, to avoid problems with meta-characters, it is suggested that the
255 entire <STRONG>-m</STRONG> option argument be placed within single quote characters, and
256 that <STRONG>csh</STRONG> users insert a backslash character ("\") before any exclama-
260 </PRE><H2><a name="h2-HISTORY">HISTORY</a></H2><PRE>
261 A <STRONG>reset</STRONG> command appeared in 2BSD (April 1979), written by Kurt Shoens.
262 This program set the <EM>erase</EM> and <EM>kill</EM> characters to <STRONG>^H</STRONG> (backspace) and <STRONG>@</STRONG>
263 respectively. Mark Horton improved that in 3BSD (October 1979), adding
264 <EM>intr</EM>, <EM>quit</EM>, <EM>start</EM>/<EM>stop</EM> and <EM>eof</EM> characters as well as changing the pro-
265 gram to avoid modifying any user settings.
267 Later in 4.1BSD (December 1980), Mark Horton added a call to the <STRONG>tset</STRONG>
268 program using the <STRONG>-I</STRONG> and <STRONG>-Q</STRONG> options, i.e., using that to improve the
269 terminal modes. With those options, that version of <STRONG>reset</STRONG> did not use
270 the termcap database.
272 A separate <STRONG>tset</STRONG> command was provided in 2BSD by Eric Allman. While the
273 oldest published source (from 1979) provides both <STRONG>tset</STRONG> and <STRONG>reset</STRONG>, All-
274 man's comments in the 2BSD source code indicate that he began work in
275 October 1977, continuing development over the next few years.
277 In September 1980, Eric Allman modified <STRONG>tset</STRONG>, adding the code from the
278 existing "reset" feature when <STRONG>tset</STRONG> was invoked as <STRONG>reset</STRONG>. Rather than
279 simply copying the existing program, in this merged version, <STRONG>tset</STRONG> used
280 the termcap database to do additional (re)initialization of the termi-
281 nal. This version appeared in 4.1cBSD, late in 1982.
283 Other developers (e.g., Keith Bostic and Jim Bloom) continued to modify
284 <STRONG>tset</STRONG> until 4.4BSD was released in 1993.
286 The <STRONG>ncurses</STRONG> implementation was lightly adapted from the 4.4BSD sources
287 for a terminfo environment by Eric S. Raymond <esr@snark.thyrsus.com>.
290 </PRE><H2><a name="h2-COMPATIBILITY">COMPATIBILITY</a></H2><PRE>
291 Neither IEEE Std 1003.1/The Open Group Base Specifications Issue 7
292 (POSIX.1-2008) nor X/Open Curses Issue 7 documents <STRONG>tset</STRONG> or <STRONG>reset</STRONG>.
294 The AT&T <STRONG>tput</STRONG> utility (AIX, HPUX, Solaris) incorporated the terminal-
295 mode manipulation as well as termcap-based features such as resetting
296 tabstops from <STRONG>tset</STRONG> in BSD (4.1c), presumably with the intention of mak-
297 ing <STRONG>tset</STRONG> obsolete. However, each of those systems still provides <STRONG>tset</STRONG>.
298 In fact, the commonly-used <STRONG>reset</STRONG> utility is always an alias for <STRONG>tset</STRONG>.
300 The <STRONG>tset</STRONG> utility provides for backward-compatibility with BSD environ-
301 ments (under most modern UNIXes, <STRONG>/etc/inittab</STRONG> and <STRONG>getty(1)</STRONG> can set <STRONG>TERM</STRONG>
302 appropriately for each dial-up line; this obviates what was <STRONG>tset</STRONG>'s most
303 important use). This implementation behaves like 4.4BSD <STRONG>tset</STRONG>, with a
304 few exceptions specified here.
306 A few options are different because the <STRONG>TERMCAP</STRONG> variable is no longer
307 supported under terminfo-based <STRONG>ncurses</STRONG>:
309 <STRONG>o</STRONG> The <STRONG>-S</STRONG> option of BSD <STRONG>tset</STRONG> no longer works; it prints an error mes-
310 sage to the standard error and dies.
312 <STRONG>o</STRONG> The <STRONG>-s</STRONG> option only sets <STRONG>TERM</STRONG>, not <STRONG>TERMCAP</STRONG>.
314 There was an undocumented 4.4BSD feature that invoking <STRONG>tset</STRONG> via a link
315 named "TSET" (or via any other name beginning with an upper-case let-
316 ter) set the terminal to use upper-case only. This feature has been
319 The <STRONG>-A</STRONG>, <STRONG>-E</STRONG>, <STRONG>-h</STRONG>, <STRONG>-u</STRONG> and <STRONG>-v</STRONG> options were deleted from the <STRONG>tset</STRONG> utility in
320 4.4BSD. None of them were documented in 4.3BSD and all are of limited
321 utility at best. The <STRONG>-a</STRONG>, <STRONG>-d</STRONG>, and <STRONG>-p</STRONG> options are similarly not docu-
322 mented or useful, but were retained as they appear to be in widespread
323 use. It is strongly recommended that any usage of these three options
324 be changed to use the <STRONG>-m</STRONG> option instead. The <STRONG>-a</STRONG>, <STRONG>-d</STRONG>, and <STRONG>-p</STRONG> options
325 are therefore omitted from the usage summary above.
327 Very old systems, e.g., 3BSD, used a different terminal driver which
328 was replaced in 4BSD in the early 1980s. To accommodate these older
329 systems, the 4BSD <STRONG>tset</STRONG> provided a <STRONG>-n</STRONG> option to specify that the new
330 terminal driver should be used. This implementation does not provide
333 It is still permissible to specify the <STRONG>-e</STRONG>, <STRONG>-i</STRONG>, and <STRONG>-k</STRONG> options without
334 arguments, although it is strongly recommended that such usage be fixed
335 to explicitly specify the character.
337 As of 4.4BSD, executing <STRONG>tset</STRONG> as <STRONG>reset</STRONG> no longer implies the <STRONG>-Q</STRONG> option.
338 Also, the interaction between the - option and the <EM>terminal</EM> argument in
339 some historic implementations of <STRONG>tset</STRONG> has been removed.
341 The <STRONG>-c</STRONG> and <STRONG>-w</STRONG> options are not found in earlier implementations. How-
342 ever, a different window size-change feature was provided in 4.4BSD.
344 <STRONG>o</STRONG> In 4.4BSD, <STRONG>tset</STRONG> uses the window size from the termcap description
345 to set the window size if <STRONG>tset</STRONG> is not able to obtain the window
346 size from the operating system.
348 <STRONG>o</STRONG> In ncurses, <STRONG>tset</STRONG> obtains the window size using <STRONG>setupterm</STRONG>, which may
349 be from the operating system, the <STRONG>LINES</STRONG> and <STRONG>COLUMNS</STRONG> environment
350 variables or the terminal description.
352 Obtaining the window size from the terminal description is common to
353 both implementations, but considered obsolescent. Its only practical
354 use is for hardware terminals. Generally speaking, a window size would
355 be unset only if there were some problem obtaining the value from the
356 operating system (and <STRONG>setupterm</STRONG> would still fail). For that reason,
357 the <STRONG>LINES</STRONG> and <STRONG>COLUMNS</STRONG> environment variables may be useful for working
358 around window-size problems. Those have the drawback that if the win-
359 dow is resized, those variables must be recomputed and reassigned. To
360 do this more easily, use the <STRONG><A HREF="resize.1.html">resize(1)</A></STRONG> program.
363 </PRE><H2><a name="h2-ENVIRONMENT">ENVIRONMENT</a></H2><PRE>
364 The <STRONG>tset</STRONG> command uses these environment variables:
367 tells <STRONG>tset</STRONG> whether to initialize <STRONG>TERM</STRONG> using <STRONG>sh</STRONG> or <STRONG>csh</STRONG> syntax.
369 TERM Denotes your terminal type. Each terminal type is distinct,
370 though many are similar.
373 may denote the location of a termcap database. If it is not an
374 absolute pathname, e.g., begins with a "/", <STRONG>tset</STRONG> removes the vari-
375 able from the environment before looking for the terminal descrip-
379 </PRE><H2><a name="h2-FILES">FILES</a></H2><PRE>
381 system port name to terminal type mapping database (BSD versions
385 terminal capability database
388 </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
389 <STRONG>csh(1)</STRONG>, <STRONG>sh(1)</STRONG>, <STRONG>stty(1)</STRONG>, <STRONG><A HREF="curs_terminfo.3x.html">curs_terminfo(3x)</A></STRONG>, <STRONG>tty(4)</STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>,
390 <STRONG>ttys(5)</STRONG>, <STRONG>environ(7)</STRONG>
392 This describes <STRONG>ncurses</STRONG> version 6.1 (patch 20191207).
396 <STRONG><A HREF="tset.1.html">tset(1)</A></STRONG>
400 <li><a href="#h2-NAME">NAME</a></li>
401 <li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li>
402 <li><a href="#h2-DESCRIPTION">DESCRIPTION</a>
404 <li><a href="#h3-tset---initialization">tset - initialization</a></li>
405 <li><a href="#h3-reset---reinitialization">reset - reinitialization</a></li>
408 <li><a href="#h2-OPTIONS">OPTIONS</a></li>
409 <li><a href="#h2-SETTING-THE-ENVIRONMENT">SETTING THE ENVIRONMENT</a></li>
410 <li><a href="#h2-TERMINAL-TYPE-MAPPING">TERMINAL TYPE MAPPING</a></li>
411 <li><a href="#h2-HISTORY">HISTORY</a></li>
412 <li><a href="#h2-COMPATIBILITY">COMPATIBILITY</a></li>
413 <li><a href="#h2-ENVIRONMENT">ENVIRONMENT</a></li>
414 <li><a href="#h2-FILES">FILES</a></li>
415 <li><a href="#h2-SEE-ALSO">SEE ALSO</a></li>