Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

My coworker has the following in the ~/.bash_profile of many of our servers:

echo -e "\033]50;SetProfile=Production\a"

The text doesn't seem to matter, since this also works:

echo -e "\033]50;ANY_TEXT\a"

But no text doesn't work; the \a is also required.

This causes his terminal in OSX to change profiles (different colours, etc.); but in my xterm, it changes the font to huge; which I can't seem to reset.

I have tried to reset this with:

  1. Setting VT fonts with shift+right click
  2. Do "soft reset" and "full reset" with shift+middle click
  3. Sending of various escape codes & commands:

    $ echo -e "\033c"    # Reset terminal, no effect
    $ echo -e "\033[0;m" # Reset attributes, no effect
    $ tput sgr0          # No effect
    $ tput reset         # No effect

My questions:

  1. Why does this work on xterm & what exactly does it do? Code 50 is listed as "Reserved"?
  2. How do I reset this?


enter image description here

share|improve this question
up vote 3 down vote accepted

Looking at the list of xterm escape codes reveals that (esc)]50;name(bel) sets the xterm's font to the font name, or to an entry in the font menu if the first character of name is a #.

The simplest way to reset it is to use the xterm's font menu (Ctrl + right mouse click) and select an entry other than Default. Alternatively, you can find out which font the xterm uses on startup, and set that with the escape sequence.

In the font menu you'll also find an option Allow Font Ops; if you uncheck that, you cannot any more change the font using escape sequences.

share|improve this answer
Using the menu doesn't work; I tried that (it does change the font, but not back to what I had), but using echo -e "\033]50;DejaVu Sans Mono:pixelsize=16\a" resets it! (I did find the list of xterm escape codes, btw, but 50 is written as 5 0, which is why I didn't find it. Do'h!) Thank you. – Carpetsmoker Aug 27 '14 at 8:42

To answer the question of how to reset it:

The xterm escape code OSC 50 ... BEL can be used to set the font (See the answer of @celtschk).

Besides setting it to a font name, it can also be set to an index in the font menu you get with Ctrl and right mouse button.

We can use this to reset to the default font by using the menu index 0:

echo -n "\e]50;#0\a

From XTerm Control Sequences - (2014/05/26):

OSC P s ; P t BEL  Set Text Parameters.

      P s = 5 0 → Set Font to P t. These controls may be disabled using the
      allowFontOps resource. If P t begins with a "#", index in the font menu,
      relative (if the next character is a plus or minus sign) or absolute. A
      number is expected but not required after the sign (the default is the
      current entry for relative, zero for absolute indexing).
      The same rule (plus or minus sign, optional number) is used when querying
      the font. The remainder of P t is ignored.
      A font can be specified after a "#" index expression, by adding a space
      and then the font specifier.
      If the "TrueType Fonts" menu entry is set (the renderFont resource),
      then this control sets/queries the faceName resource.
share|improve this answer
Using #n doesn't seem to work, in any case, it's the same as selecting the entry from the menu, which also doesn't work. – Carpetsmoker Aug 27 '14 at 12:04
Hmm... for me it worked - but it did not work with the DejaVu example. (There are too many options that could be different...) Th #0 was useful as the menu does not show which font is the default as far as I can see. – Volker Siegel Aug 27 '14 at 12:08
You also don't get the original font back by selecting Default on the xterm (assuming you changed it using a font name with the escape sequence; changing to another menu item and then back to default works, of course). At least it didn't in my experiments. – celtschk Aug 30 '14 at 17:07

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.