Go to main content

man pages section 1: User Commands

Exit Print View

Updated: Wednesday, July 27, 2022

resize (1)


resize - set environment and terminal settings to current xterm window size


resize [ -v | -u | -c ] [ -s [ row col ] ]


RESIZE(1)                       X Window System                      RESIZE(1)

       resize  - set environment and terminal settings to current xterm window

       resize [ -v | -u | -c ] [ -s [ row col ] ]

       Resize prints a shell command for setting the  appropriate  environment
       variables  to  indicate the current size of xterm window from which the
       command is run.

       Resize determines the command through several steps:

       o   first, it finds the name of the user's shell program.  It uses  the
           SHELL  variable  if  set,  otherwise  it  uses the user's data from

       o   then it decides whether to use Bourne shell syntax or C-Shell  syn-
           tax.   It uses a built-in table of known shells, which can be over-
           ridden by the -u and -c options.

       o   then resize asks the operating system for  the  terminal  settings.
           This is the same information which can be manipulated using stty.

       o   then  resize asks the terminal for its size in characters.  Depend-
           ing on whether the "-s option is given,  resize  uses  a  different
           escape sequence to ask for this information.

       o   at  this  point, resize attempts to update the terminal settings to
           reflect the terminal window's size in pixels:

           o   if the -s option is used, resize then asks the terminal for its
               size in pixels.

           o   otherwise, resize asks the operating system for the information
               and updates that after ensuring that  the  window's  dimensions
               are a multiple of the character height and width.

           o   in  either case, the updated terminal settings are done using a
               different system call than used for stty.

       o   then resize updates the terminal settings to  reflect  any  altered
           values  such as its size in rows or columns.  This affects the val-
           ues shown by stty.

       o   finally, resize generates shell commands for setting  the  environ-
           ment variables, and writes that to the standard output.

       For  resize's output to take effect, resize must either be evaluated as
       part of the command line (usually done with a shell alias or  function)
       or  else  redirected  to  a file which can then be read in.  From the C
       shell (usually known as /bin/csh), the following alias could be defined
       in the user's .cshrc:

               %  alias rs 'set noglob; eval `resize`'

       After resizing the window, the user would type:

               %  rs

       Users  of  versions of the Bourne shell (usually known as /bin/sh) that
       don't have command functions will need to send the output to  a  tempo-
       rary file and then read it back in with the "." command:

               $  resize > /tmp/out
               $  . /tmp/out

       The following options may be used with resize:

       -c      This option indicates that C shell commands should be generated
               even if the user's current shell does not appear to use C shell

       -s [rows columns]
               This option indicates that Sun console escape sequences will be
               used instead of the VT100-style xterm escape  codes.   If  rows
               and  columns  are  given,  resize  will ask the xterm to resize
               itself using those values.

               Both of the escape sequences used for  this  option  (first  to
               obtain  the window size and second to modify it) are subject to
               xterm's allowWindowOps resource setting.   The  window  manager
               may also choose to disallow the change.

               The  VT100-style  escape  sequence used to determine the screen
               size always works for VT100-compatible terminals.  VT100s  have
               no corresponding way to modify the screensize.

       -u      This option indicates that Bourne shell commands should be gen-
               erated even if the user's current shell does not appear to  use
               Bourne shell syntax.

       -v      This  causes  resize  to print a version number to the standard
               output, and then exit.

       Note that the Sun console escape sequences are  recognized  by  XFree86
       xterm  and  by dtterm.  The resize program may be installed as sunsize,
       which causes makes it assume the -s option.

       The rows and columns arguments must appear last; though they  are  nor-
       mally associated with the -s option, they are parsed separately.

       /etc/termcap   for the base termcap entry to modify.

       ~/.cshrc       user's alias for the command.

       SHELL          Unless  overridden  by  the -c option, resize determines
                      the user's current shell by

                      o   first checking if $SHELL is set, and using that,

                      o   otherwise  resize  looks  in   the   password   file

                      Generally  Bourne-shell  variants (including ksh) do not
                      modify $SHELL, so it is possible for resize to  be  con-
                      fused  if  one  runs  resize from a Bourne shell spawned
                      from a C shell.

                      After determining the user's shell, resize   checks  the
                      shell's  name  against a table of known shell names.  If
                      it does not find the name in its table, resize will  use
                      C  shell  syntax for the generated commands to set envi-
                      ronment variables.

       TERM           Resize's generated shell command sets this to "xterm" if
                      not already set.

       TERMCAP        Resize's  generated  shell command sets this variable on
                      systems using termcap, e.g., when resize is linked  with
                      the termcap library rather than a terminfo library.  The
                      latter does not provide the complete text for a  termcap

       COLUMNS, LINES Resize's generated shell command sets these variables on
                      systems using terminfo.   Many  applications  (including
                      the  curses  library)  use  those  variables when set to
                      override their screensize.

       See attributes(7) for descriptions of the following attributes:

       |Availability   | terminal/resize  |
       |Stability      | Volatile         |

       csh(1), stty(1), tset(1)

       Mark Vandevoorde (MIT-Athena), Edward Moy (Berkeley)
       Thomas Dickey (invisible-island.net).
       Copyright (c) 1984, 1985 by X Consortium
       See X(1) for a complete copyright notice.

       Source code for open source software components in Oracle  Solaris  can
       be found at https://www.oracle.com/downloads/opensource/solaris-source-

       This    software    was    built    from    source     available     at
       https://github.com/oracle/solaris-userland.    The  original  community
       source   was    downloaded    from     https://invisible-mirror.net/ar-

       Further information about this software can be found on the open source
       community website at http://invisible-island.net/xterm/.

Patch #371                        2022-02-24                         RESIZE(1)