Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > T


HP-UX 11i Version 3: February 2007

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index


tset, reset — terminal-dependent initialization


tset [options] [-m [ident] [test baudrate] :type]... [type]



tset sets up the terminal when logging in on an HP-UX system. It does terminal-dependent processing, such as setting erase and kill characters, setting or resetting delays, and sending any sequences needed to properly initialize the terminal. It first determines the type of terminal involved, then does the necessary initializations and mode settings. The type of terminal attached to each HP-UX port is specified in the /etc/ttytype data base. Type names for terminals can be found in the files under the /usr/share/lib/terminfo directory (see terminfo(4)). If a port is not wired permanently to a specific terminal (not hardwired), it is given an appropriate generic identifier, such as dialup.

reset performs a similar function, setting the terminal to a sensible default state.

In the case where no arguments are specified, tset simply reads the terminal type out of the environment variable TERM and re-initializes the terminal. The rest of this manual entry concerns itself with mode and environment initialization, typically done once at login, and options used at initialization time to determine the terminal type and set up terminal modes.

When used in a startup script (.profile for sh(1), or .login for csh(1) users), it is desirable to give information about the type of terminal that will normally be used on ports that are not hardwired. These ports are identified in /etc/ttytype as dialup or plugboard, etc. To specify what terminal type you usually use on these ports, the -m (map) option flag is followed by the appropriate port type identifier, an optional baud rate specification, and the terminal type. (The effect is to "map" from some conditions to a terminal type; that is, to tell tset that "If I am on this kind of port, I will probably be on this kind of terminal.") If more than one mapping is specified, the first applicable mapping prevails. A missing port type identifier matches all identifiers. A baudrate is specified as with stty (see stty(1)), and is compared with the speed of the diagnostic output (which should be the control terminal). The baud rate test can be any combination of >, =, <, @, and !. @ is a synonym for =, and ! inverts the sense of the test. To avoid problems with metacharacters, it is best to place the entire argument to -m within single quotes; users of csh(1) must also put a \ before any ! used.


tset -m 'dialup>300:2622' -m 'dialup:2624' -m 'plugboard:?2623'

causes the terminal type to be set to an HP 2622 if the port in use is a dialup at a speed greater than 300 baud, or to an HP 2624 if the port is otherwise a dialup (i.e., at 300 baud or less). If the type finally determined by tset begins with a question mark, the user is asked for verification that the type indicated is really the one desired. A null response means to use that type; otherwise, another type can be entered. Thus, in the above case, if the user is on a plugboard port, he or she will be asked whether or not he or she is actually using an HP 2623.

If no mapping applies and a final type option, not preceded by a -m, is given on the command line, that type is used. Otherwise, the identifier found in the /etc/ttytype data base is taken to be the terminal type. The latter should always be the case for hardwired ports.

It is usually desirable to return the terminal type, as finally determined by tset, and information about the terminal's capabilities to a shell's environment. This can be done using the -s option. From sh(1), the command:

eval `tset -s options...`

or using the C shell, (csh(1)):

set noglob; eval `tset -s options...`

These commands cause tset to generate as output a sequence of shell commands which place the variable TERM in the environment; see environ(5).

Once the terminal type is known, tset engages in terminal mode setting. This normally involves sending an initialization sequence to the terminal, setting the single character erase (and optionally the full line erase or line-kill) characters, and setting special character delays. Tab and new-line expansion are turned off during transmission of the terminal initialization sequence.

On terminals that can backspace but not overstrike (such as a CRT), and when the erase character is the default erase character (# on standard systems), the erase character is changed to Backspace.


tset recognizes the following options:


Set the erase character to be the named character c; c defaults to what the terminfo database (see terminfo(4)) entry reports to be the character sent by the Backspace key (usually ^H). The character c can either be typed directly, or entered using circumflex notation used here (e.g., the circumflex notation for control-H is ^H).


Set the kill character to c. The default c is ^X. If c is not specified, the kill character remains unchanged unless the original value of the kill character is null, in which case the kill character is set to @.


Report terminal type. Whatever type is decided on is reported. If no other flags are given, the only effect is to write the terminal type on the standard output. Has no effect if used with -s.


Generate appropriate commands (depending on current SHELL environment variable) to set TERM.


Suppress transmitting terminal initialization strings.


Suppress printing the Erase set to and Kill set to messages.


Ask the user for the TERM type.


Output the strings that would be assigned to TERM in the environment rather than generating commands for a shell. In sh(1), the following is an alternate way of setting TERM:

set -- `tset -S ...` TERM=$1


Force a read of /etc/ttytype. When -h is not specified, the terminal type is determined by reading the environment unless some mapping is specified.

For compatibility with earlier versions of tset, the following flags are accepted, but their use is discouraged:


Report to the user in addition to other flags.


Set the erase character to c only if the terminal can backspace. c defaults to what the terminfo database (see terminfo(4)) entry reports to be the character sent by the Backspace key (usually ^H).

In addition to capabilities described in terminfo (see termio(7) and terminfo(4)), the following boolean terminfo capabilities are understood by tset and reset, and can be included in the terminfo database for the purpose of terminal setup:


"Uppercase" mode sets character mapping for terminals that support only uppercase characters. Equivalent to stty lcase.


"Lowercase" mode permits input and output of lowercase characters. Equivalent to stty -lcase.


Set "even parity". Equivalent to stty parenb -parodd


Set "odd parity". Equivalent to stty parenb parodd.


Set "new line" mode. Equivalent to stty onlret.


Set "half-duplex" mode. Equivalent to stty -echo.


Set "print tabs" mode. Equivalent to stty tabs.


Environment Variables


if csh, generate csh commands; otherwise generate sh(1) commands.


the (canonical) terminal name.


These examples all assume the sh(1). Note that a typical use of tset in a .profile also uses the -e and -k options, and often the -m or -Q options as well. These options have been omitted here to keep the examples small.

Assume, for the moment, that you are on an HP 2622. This is suitable for typing by hand but not for a .profile unless you are always on a 2622.

export TERM; TERM=`tset - 2622`

Assume you have an HP 2623 at home that you dial up on, but your office terminal is hardwired and known in /etc/ttytype.

export TERM; TERM=`tset - -m dialup:2623`

Suppose you are accessing the system through a switching network that can connect any system to any incoming modem line in an arbitrary combination, making it nearly impossible to key on what port you are coming in on. Your office terminal is an HP 2622, and your home terminal is an HP 2623 running at 1200 baud on dial-up switch ports. Sometimes you use someone else's terminal at work, so you want it to verify what terminal type you have at high speeds, but at 1200 baud you are always on a 2623. Note the placement of the question mark and the quotes to protect the > and ? from interpretation by the shell.

export TERM; TERM=`tset - -m 'switch>1200:?2622' -m 'switch<=1200:2623'`

All of the above entries fall back on the terminal type specified in /etc/ttytype if none of the conditions hold. The following entry is appropriate if you always dial up, always at the same baud rate, on many different kinds of terminals. Your most common terminal is an HP 2622. It always asks you what kind of terminal you are on, defaulting to 2622.

export TERM; TERM=`tset - ?2622`

If the file /etc/ttytype is not properly installed and you want to key entirely on the baud rate, the following can be used:

export TERM; TERM=`tset - -m '>1200:2624' 2622`


tset was developed by the University of California, Berkeley.



port-name to terminal-type mapping data base


terminal information data base

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.