This is a nice thing that works for any XTerm based terminal, in particular for Mac OS X's default terminal. To change the terminal window size from the command line, use a command of the following form:
echo -ne '\e[8;Y;Xt'
where X
stands for the desired window width and Y
stands for the desired window height. For example, to get an 80×50 terminal, you could use the following script:
#!/bin/sh echo -ne '\e[8;50;80t'
or you could place this into an inline function, loaded in your .bashrc
file or similar:
<code>
function ts
{
if [[ -n "$1" && -n "$2" && $1 > 0 && $2 > 0 ]]; then echo -ne "\e[8;$2;$1t" fi
} function ts8025 {
ts 80 25
} <code> You can also set the window size in pixels instead of characters if you prefer. Just replace the 8 in the above command with a 4, like:
echo -ne '\e[4;Ypix;Xpixt'