User Tools

Site Tools



This shows you the differences between two versions of the page.

Link to this comparison view

xtermsize [2008/02/12 13:56] (current)
kleiner created
Line 1: Line 1:
 +====== Programatically Setting the XTerm Screen Size ======
 +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 80x50 terminal, you could use the following script:
 +echo -ne '​\e[8;​50;​80t'​
 +or you could place this into an inline function, loaded in your ''​.bashrc''​ file or similar:
 +function ts
 +    if [[ -n "​$1" ​ && ​ -n "​$2"​ && $1 > 0 && $2 > 0 ]]; then
 +        echo -ne "​\e[8;​$2;​$1t" ​
 +    fi  ​
 +function ts8025
 +    ts 80 25
 +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'​
xtermsize.txt ยท Last modified: 2008/02/12 13:56 by kleiner