Escape code 50 in xterm

escape-charactersxterm

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?

Screenshot:

enter image description here

Best Answer

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.

Related Question