*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->HP-UX 11i man pages -> ttytype (1)              


 ttytype(1)                                                       ttytype(1)

 NAME    [Toc]    [Back]
      ttytype - terminal identification program

 SYNOPSIS    [Toc]    [Back]
      ttytype [-apsv] [-t type]

 DESCRIPTION    [Toc]    [Back]
      ttytype automatically identifies the current terminal type by sending
      an identification request sequence to the terminal.  This method works
      for local, modem, and remote terminal connections, as well as for the
      hpterm and xterm terminal emulators.

      Once the terminal has been identified, ttytype prints the terminal's
      type to the standard output (see terminfo(4)).  This string is usually
      used as the value for the TERM environment variable.

      If ttytype is unable to determine the correct terminal type, it
      prompts the user for the correct terminal identification string.

    Options    [Toc]    [Back]
      ttytype recognizes the following options:

           -a          Causes ttytype to return an ID of "unknown" instead
                       of prompting for the terminal type if autoidentification
 fails.  If this option is not present,
                       ttytype interactively prompts the user for the
                       terminal type if it is unable to determine the
                       correct type automatically.

           -p          Causes ttytype to prompt for the terminal type before
                       it sends the terminal identification request
                       sequence.  If the user responds with only a carriage
                       return, ttytype proceeds with the automatic terminal
                       identification process.  Any other response is taken
                       as the correct terminal type.  Note that the LINES
                       and COLUMNS variables are not set if the user
                       manually enters a terminal type.

                       The -p option is normally used only for terminals
                       that do not behave well when presented with ttytype's
                       terminal identification request sequence.  It gives
                       the user a chance to respond with the correct
                       terminal type before any escape sequences are sent
                       that could have an adverse effect on the terminal.

                       The -a option can be used in conjunction with the -p
                       option.  The -a option only inhibits interactive
                       prompting after ttytype has failed to identify the
                       terminal by other means.

 Hewlett-Packard Company            - 1 -   HP-UX 11i Version 2: August 2003

 ttytype(1)                                                       ttytype(1)

           -s          Tells ttytype to print a series of shell commands to
                       set the TERM, LINES, and COLUMNS environment
                       variables to appropriate values.  In addition, the
                       variable ERASE is set to the two-character sequence
                       representing the appropriate erase character for the
                       terminal (DEL for ANSI terminals, backspace for all
                       others).  This two-character sequence can then be
                       used as an argument to stty or tset (see stty(1) and

                       The SHELL environment variable is consulted to see
                       which shell syntax to use for setting the environment
                       variables.  This output is normally used with a
                       command of the form:

                            eval `ttytype -s`

           -t type     ttytype normally attempts identification of Wyse,
                       ANSI and HP terminals.  The -t type argument can be
                       used to restrict the inquiry to that required for
                       terminals of the specified type.  The accepted types
                       are ansi, hp, and wyse.  Multiple -t options can be

           -v          Enable verbose messages to standard error.

    Notes    [Toc]    [Back]
      Use of the -s option is highly recommended because many terminals
      support variable-size displays.  This option provides the only means
      for automatically configuring the user environment in such a manner
      that applications can handle these terminals correctly.  Note that
      LINES and COLUMNS are not set if the -p option is used and the user
      manually enters a terminal type.

      The following steps are performed in the order indicated when
      identifying a terminal:

           1. ttytype tries the Wyse 30/50/60 id request sequence.

           2. ttytype tries the standard ANSI id request sequence.  If a
              response is received, it is converted to a string according to
              an internal table.

           3. ttytype tries the HP id request sequence.

           4. If none of the above steps succeed, ttytype prompts
              interactively for the correct terminal type unless the -a
              option has been given.

      ttytype may skip one or more of the first three steps, depending on
      the presence of -t options.

 Hewlett-Packard Company            - 2 -   HP-UX 11i Version 2: August 2003

 ttytype(1)                                                       ttytype(1)

      The HP ID-request sequence can switch some ANSI terminals into an
      unexpected operating mode.  Recovery from such a condition sometimes
      requires cycling power on the terminal.  To avoid this problem,
      ttytype always sends the HP identification sequence last.

 EXAMPLES    [Toc]    [Back]
      ttytype is most commonly used as part of the login sequence.  The
      following shell script fragment can be used during login shell

           # If TERM is not set, see if our port is listed in /etc/ttytype.
           # If /etc/ttytype doesn't have information for our port, run
           # ttytype(1) to try to determine the type of terminal we have.
           # To have ttytype(1) prompt for the terminal type before trying
           # to automatically identify the terminal, add the "-p" option
           # to the "ttytype -s" command below.
           if [ -z "$TERM" -o "$TERM" = network ]; then
               unset TERM
               eval `tset -s -Q`
               if [ -z "$TERM" -o "$TERM" = unknown ]; then
                eval `ttytype -s`
                tset -Q -e ${ERASE:-\^h} $TERM

 WARNINGS    [Toc]    [Back]
      The terminal identification sequences sent by ttytype can cause
      unexpected behavior on terminals other than the Wyse 30/50/60,
      standard ANSI or HP terminals.  If you have such terminals in your
      configuration, use the -t or -p options to prevent ttytype from
      sending sequences that cause unexpected behavior.

 AUTHOR    [Toc]    [Back]
      ttytype was developed by HP.

 SEE ALSO    [Toc]    [Back]
      csh(1), ksh(1), sh(1), stty(1), ttytype(4), environ(5).

 Hewlett-Packard Company            - 3 -   HP-UX 11i Version 2: August 2003
[ Back ]
 Similar pages
Name OS Title
openvt Linux start a program on a new virtual terminal (VT).
getpid Linux get process identification
getuid FreeBSD get user identification
geteuid FreeBSD get user identification
geteuid OpenBSD get user identification
geteuid NetBSD get user identification
model HP-UX HP-UX machine identification
getuid OpenBSD get user identification
uname FreeBSD get system identification
getuid NetBSD get user identification
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service