I am a loyal Linux fan who has been spending a lot of time using iTerm on a mac lately. One thing I really like about the mac, and iTerm in particular, is the ability to use a keyboard shortcut to in/decrease the font size. I believe it's apple+ and apple- to do this. AFAIK this is also possible using gnome-terminal and possibly konqueror.

However, I am an rxvt-unicode user. Period. I'm not willing to switch my terminal, but I would like to be able to have the ability to quickly resize the font. Currently, to resize the font I have to do this:

  1. Detach tmux
  2. $EDITOR ~/.Xdefaults
  3. xrdb -all ~/.Xdefaults
  4. close terminal
  5. open a new terminal
  6. Reattach tmux

I'm thinking that it must be possible to script something that would reduce the above steps to one by perhaps binding to a keyboard shortcut, maybe with xbindkeys or something similar. Anyone have any thoughts on how this might best be accomplished?

Note: I'm using awesome window manager and prefer to keep things ultra-simple (i.e., no Gnome/KDE-specific solutions, please).

@Keith: I am familiar with the escape sequences and it's my fault for not saying so explicitly in my original question, but: I'm looking for a solution that will persist between sessions. Likely that will involve writing some code.


From the man page:

CHANGING FONTS Changing fonts (or font sizes, respectively) via the keypad is not yet supported in rxvt-unicode. Bug me if you need this.

   You can, however, switch fonts at runtime using escape sequences,


      printf '\e]710;%s\007' "9x15bold,xft:Kochi Gothic"

   You can use keyboard shortcuts, too:

      URxvt.keysym.M-C-1: command:\033]710;suxuseuro\007\033]711;suxuseuro\007
      URxvt.keysym.M-C-2: command:\033]710;9x15bold\007\033]711;9x15bold\007

   rxvt-unicode will automatically re-apply these fonts to the output so


Depending on the shell you use you could assign those to keyboard shortcuts. In zsh you could define a shell function and use bindkey to bind it to an alt-key for example.

  • Correct me if I'm wrong but this will not persist, right? – g33kz0r Jun 6 '11 at 4:28
  • Sure it will. The keysym shortcuts you put in your ~/.Xdefaults file. If you use the shell functions and keybindings you put those in your ~/.zshrc (or whatever) file. – Keith Jun 6 '11 at 4:32
  • I think we are defining "persist" differently. Your proposed solution of echoing escape sequences will not persist in a new process (new terminal window). See my (accepted) answer below for a solution that does "persist" in the sense that it outlives its parent process. – g33kz0r Jul 6 '12 at 1:38

I'm answering my own question (with code!) and upvoting Keith for his keysym suggestion. However, Keith's solution does not persist the resized font to the Xresources file, so that the resize is available when the next window is opened, whereas mine does:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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