Can a Terminal window be resized with a Terminal command?
Yes. Terminal supports escape sequences for manipulating windows, including the size and position, layering, and minimizing. Dimensions can be expressed in pixels or characters. See Xterm Control Sequences for details (search for “Window manipulation”; if you’re not familiar with the notation, “CSI” stands for “Control Sequence Introducer”, which is ESC [).

For example, this shell command will set the window to 100x50 characters:

printf '\e[8;50;100t'


Minimize the window for a few seconds, then restore it:

printf '\e[2t' &amp;&amp; sleep 3 &amp;&amp; printf '\e[1t'


Move the window to the top/left corner of the display:

printf '\e[3;0;0t'


Zoom the window:

printf '\e[9;1t'


Bring the window to the front (without changing keyboard focus):

printf '\e[5t'


Enabling the Control Sequences in Terminal Emulators

Some terminal emulators ignore these control sequences by default and require configuration to enable them.

To enable these in XTerm, set the following resource to true:


  allowWindowOps


To enable these in iTerm2, deselect the following preference:


  Preferences > Profiles > [profile] > Terminal > Disable session-initiated window resizing