Super User is a question and answer site for computer enthusiasts and power users. 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

I'm new to tmux, and I'm having trouble finding a solution to resizing my actual terminal (I haven't learned quite enough about panes and windows yet).

I'm running tmux1.6, and bash as my shell, on ubuntu12.04. bash has a builtin function resize which seems to work outside of tmux just fine.

% resize -s 50 80

resizes the terminal to 80 characters wide and 50 lines tall. However, when I try to run this exact command inside a tmux pane, it hangs after I hit enter, until I hit any key, and then responds

"resize: unknown character, exiting" 

which is a bit opaque to me. Now, I don't need to use the resize function per se, but how can I, through a command (built in or scripted), physically resize the terminal that is displaying my tmux windows? The use case for this is that when I decide to open a new vertical pane, both of which contain code, I want my terminal to be an exact number of characters wide (2 panes = 161 characters, 80 for each and 1 for the dividing line, for example). Resizing with the mouse is not only tedious; my ubuntu doesn't display the width while I'm resizing.

Any help is appreciated, thanks!

share|improve this question

It seems that tmux isn't letting the escape characters through.

I filed a bug report on the tmux bug-tracker - so hopefully it can be fixed:

-- edit: added workaround --

It seems you can force tmux to let specific escape command through: You can use printf '\033Ptmux;whatever\033' but you need to double up \033.

So I wrote a small bash function (put it in your .bashrc or .bash_profile), that tests if your are inside of tmux and prints out the escape codes (tested in xterm, Apple Terminal and iTerm):

 function resimux {                                                                                                                                                           
     if [ ! -z "$TMUX" ]; then
         printf '\ePtmux;\e\e[8;%i;%it\e\' $1 $2
         printf '\e[8;%i;%it' $1 $2

Then you can call it like this:

 resimux 50 80

The resize escape sequence is send to all connected terminals.


share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .