Seth Woolley's Man Viewer

tput(1) - reset, tput, reset, tput - initialize a terminal or query terminfo database - man 1 tput

([section] manual, -k keyword, -K [section] search, -f whatis)
man plain no title

tput(1)                                                                tput(1)



NAME
       tput, reset(1,7,1 tput) - initialize a terminal or query terminfo database

SYNOPSIS
       tput [-Ttype] capname [parms ... ]
       tput [-Ttype] init
       tput [-Ttype] reset(1,7,1 tput)
       tput [-Ttype] longname
       tput -S  <<
       tput -V

DESCRIPTION
       The  tput utility uses the terminfo database to make the values of ter-
       minal-dependent capabilities and information  available  to  the  shell
       (see  sh(1)),  to  initialize or reset(1,7,1 tput) the terminal, or return the long
       name of the requested terminal type.  tput  outputs  a  string(3,n)  if(3,n)  the
       attribute  (capability  name)  is  of type string(3,n), or an integer if(3,n) the
       attribute is of type integer.  If the attribute  is  of  type  boolean,
       tput  simply  sets  the  exit(3,n,1 builtins)  code (0 for TRUE if(3,n) the terminal has the
       capability, 1 for FALSE if(3,n)  it  does  not),  and  produces  no  output.
       Before  using a value returned on standard output, the user should test
       the exit(3,n,1 builtins) code [$?, see sh(1)] to be sure it is 0.  (See the EXIT  CODES
       and DIAGNOSTICS sections.)  For a complete list of capabilities and the
       capname associated with each, see terminfo(1).

       -Ttype indicates the type of terminal.  Normally this option is  unnec-
              essary,  because the default is taken from the environment vari-
              able TERM.  If -T is specified, then the shell  variables  LINES
              and COLUMNS will be ignored,and the operating system will not be
              queried for the actual screen size.

       capname
              indicates the attribute from the terminfo database.  When  term-
              cap  support  is compiled in(1,8), the termcap name for the attribute
              is also accepted.

       parms  If the attribute is a string(3,n) that takes  parameters,  the  argu-
              ments  parms  will  be  instantiated  into  the string.  An all-
              numeric argument will be passed to the attribute as a number.

              Only a few terminfo capabilities require string(3,n) parameters; tput
              uses  a table to decide which to pass as strings.  Normally tput
              uses tparm (3X) to perform the substitution.  If  no  parameters
              are given for the attribute, tput writes the string(3,n) without per-
              forming the substitution.

       -S     allows more than one capability per  invocation  of  tput.   The
              capabilities  must  be  passed  to  tput from the standard input
              instead of from the command line (see example).  Only  one  cap-
              name  is allowed per line.  The -S option changes the meaning of
              the 0 and 1 boolean and string(3,n) exit(3,n,1 builtins) codes (see  the  EXIT  CODES
              section).

              Again,  tput  uses a table and the presence of parameters in(1,8) its
              input to decide whether to use tparm (3X), and how to  interpret
              the parameters.

       -V     reports  the  version(1,3,5) of ncurses which was used in(1,8) this program,
              and exits.

       init   If the terminfo database is present and an entry for the  user's
              terminal  exists  (see -Ttype, above), the following will occur:
              (1) if(3,n) present, the terminal's initialization  strings  will  be
              output  (is1,  is2,  is3, if(3,n), iprog), (2) any delays (e.g., new-
              line) specified in(1,8) the entry will be set(7,n,1 builtins) in(1,8) the tty(1,4) driver,  (3)
              tabs  expansion will be turned on or off according to the speci-
              fication in(1,8) the entry, and (4) if(3,n) tabs are not  expanded,  stan-
              dard  tabs  will  be set(7,n,1 builtins) (every 8 spaces).  If an entry does not
              contain the information needed for any of the four above activi-
              ties, that activity will silently be skipped.

       reset(1,7,1 tput)  Instead  of  putting  out initialization strings, the terminal's
              reset(1,7,1 tput) strings will be output if(3,n) present (rs1, rs2, rs3, rf).  If
              the  reset(1,7,1 tput)  strings  are not present, but initialization strings
              are, the initialization  strings  will  be  output.   Otherwise,
              reset(1,7,1 tput) acts identically to init.

       longname
              If  the terminfo database is present and an entry for the user's
              terminal exists (see -Ttype above), then the long  name  of  the
              terminal will be put out.  The long name is the last name in(1,8) the
              first line of the terminal's description in(1,8) the  terminfo  data-
              base [see term(5,7)(5)].

       If  tput  is invoked by a link(1,2) named(5,8) reset(1,7,1 tput), this has the same effect as
       tput reset(1,7,1 tput).  See tset for comparison, which has similar behavior.

EXAMPLES
       tput init
            Initialize the terminal according to the type of terminal  in(1,8)  the
            environmental  variable  TERM.  This command should be included in(1,8)
            everyone's .profile after the environmental variable TERM has been
            exported, as illustrated on the profile(5) manual page.

       tput -T5620 reset(1,7,1 tput)
            Reset  an  AT&T  5620 terminal, overriding the type of terminal in(1,8)
            the environmental variable TERM.

       tput cup 0 0
            Send the sequence to move(3x,7,3x curs_move) the cursor to row 0, column 0 (the upper
            left  corner  of  the  screen,  usually known as the "home" cursor
            position).

       tput clear(1,3x,3x clrtobot)
            Echo the clear-screen sequence for the current terminal.

       tput cols
            Print the number of columns for the current terminal.

       tput -T450 cols
            Print the number of columns for the 450 terminal.

       bold=`tput smso` offbold=`tput rmso`
            Set the shell variables bold, to begin  stand-out  mode  sequence,
            and offbold, to end standout mode sequence, for the current termi-
            nal.  This might be followed by a prompt: echo(1,3x,1 builtins) "${bold}Please type
            in(1,8) your name: ${offbold}\c"

       tput hc
            Set  exit(3,n,1 builtins)  code to indicate if(3,n) the current terminal is a hard copy
            terminal.

       tput cup 23 4
            Send the sequence to move(3x,7,3x curs_move) the cursor to row 23, column 4.

       tput cup
            Send the terminfo string(3,n) for cursor-movement, with  no  parameters
            substituted.

       tput longname
            Print  the  long  name  from the terminfo database for the type of
            terminal specified in(1,8) the environmental variable TERM.

            tput -S <<!
            > clear(1,3x,3x clrtobot)
            > cup 10 10
            > bold
            > !

            This example shows tput processing  several  capabilities  in(1,8)  one
            invocation.   It  clears  the screen, moves the cursor to position
            10, 10 and turns on bold (extra bright) mode.  The list is  termi-
            nated by an exclamation mark (!) on a line by itself.

FILES
       @TERMINFO@
              compiled terminal description database

       /usr/include/curses.h
              curses(3X) header file(1,n)

       /usr/include/term.h
              terminfo header file(1,n)

       @DATADIR@/tabset/*
              tab  settings  for some terminals, in(1,8) a format appropriate to be
              output to the terminal (escape sequences that  set(7,n,1 builtins)  margins  and
              tabs);  for  more information, see the "Tabs and Initialization"
              section of terminfo(5)

EXIT CODES
       If the -S option is used, tput checks for errors from each line, and if(3,n)
       any  errors  are  found, will set(7,n,1 builtins) the exit(3,n,1 builtins) code to 4 plus the number of
       lines with errors.  If no errors are found, the exit(3,n,1 builtins)  code  is  0.   No
       indication  of which line failed can be given so exit(3,n,1 builtins) code 1 will never
       appear.  Exit codes 2, 3, and 4 retain their usual interpretation.   If
       the  -S  option  is not used, the exit(3,n,1 builtins) code depends on the type of cap-
       name:

            boolean
                   a value of 0 is set(7,n,1 builtins) for TRUE and 1 for FALSE.

            string(3,n) a value of 0 is set(7,n,1 builtins) if(3,n) the capname is defined for this ter-
                   minal  type  (the  value of capname is returned on standard
                   output); a value of 1 is set(7,n,1 builtins) if(3,n) capname is not defined  for
                   this terminal type (nothing is written to standard output).

            integer
                   a value of 0 is always  set(7,n,1 builtins),  whether  or  not  capname  is
                   defined for this terminal type.  To determine if(3,n) capname is
                   defined for this terminal type,  the  user  must  test  the
                   value written to standard output.  A value of -1 means that
                   capname is not defined for this terminal type.

            other  reset(1,7,1 tput) or init may fail to find their respective files.   In
                   that case, the exit(3,n,1 builtins) code is set(7,n,1 builtins) to 4 + errno.

       Any other exit(3,n,1 builtins) code indicates an error(8,n); see the DIAGNOSTICS section.

DIAGNOSTICS
       tput  prints  the  following  error(8,n) messages and sets the corresponding
       exit(3,n,1 builtins) codes.


       exit(3,n,1 builtins) code   error(8,n) message
       ---------------------------------------------------------------------
       0           (capname is a numeric variable that is not specified  in(1,8)
                   the  terminfo(1)  database  for this terminal type, e.g.
                   tput -T450 lines and tput -T2621 xmc)
       1           no error(8,n) message is printed, see the EXIT CODES section.
       2           usage error(8,n)
       3           unknown terminal type or no terminfo database
       4           unknown terminfo capability capname
       >4          error(8,n) occurred in(1,8) -S
       ---------------------------------------------------------------------

PORTABILITY
       The longname and -S options, and  the  parameter-substitution  features
       used in(1,8) the cup example, are not supported in(1,8) BSD curses or in(1,8) AT&T/USL
       curses before SVr4.

SEE ALSO
       @CLEAR@(1), stty(1), tabs(1), terminfo(5).



                                                                       tput(1)

References for this manual (incoming links)