Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So that I could resize the window to a certain size from within Terminal.

share|improve this question
up vote 26 down vote accepted

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' && sleep 3 && 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'
share|improve this answer
This is just perfect! – LopSae Apr 6 '12 at 22:34
From now on you are my god! – d12frosted Jan 5 '15 at 7:43
This doesn't seem to work on Yosemite with iterm2 – Jistanidiot May 11 '15 at 20:35
This works great but it seems Terminal does not accept resizings that would make the window only partially visible on the screen. I just tried printf '\e[8;100;100t' and this truncated to 79x100, just what could be fit. My problem is that I need to bypass the mouse just for this case of enlarging Terminal beyond the screen limits ... – phs Oct 3 '15 at 8:22
@phs Why do you need the window to be larger than the screen? – Chris Page Oct 3 '15 at 9:23

You could always use AppleScript:

setwidth() { osascript -e "tell app \"Terminal\" to tell window 1
set b to bounds
set item 3 of b to (item 1 of b) + $1
set bounds to b
end"; }
share|improve this answer

Use /usr/X11/bin/resize.

resize -s 30 80 will give you 30 rows and 80 columns.

resize -s 30 0 will give you 30 rows and full columns.

resize -s 0 80 will give you full rows and 80 columns.

share|improve this answer
This solution is not limited to MacOS. It is terminal-based, so it should work on all terminals. I use this to resize PuTTY windows on Windows running bash shells with TERM=xterm. – DrStrangepork Dec 22 '14 at 17:44
This doesn't seem to work on Yosemite in iterm2. – Jistanidiot May 11 '15 at 20:35

Actually you know, moving an resizing windows with a mouse is horribly slow.

I've been using this app SizeUp for a very long time now. It basically resizes any application window by using your keyboard command.

You can do the following (my custom keyboard commands below):

  • make the window full screen (control + option + command + m)
  • move a window 1/2 screen size to the left or right (control + option + command + / )
  • move a window 1/4 screen size to any corner (control + option + shift + ///)
  • move windows between screens
  • move windows between spaces

I think this might do the trick and also help with other window management.

share|improve this answer
Although useful, this doesn't address the question the questioner asked. – Andrew Ferrier Oct 25 '12 at 19:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.