Difference between revisions of "Xterm"

From ArchWiki
Jump to: navigation, search
(Tips: Removed 'Xterm menu' subsection)
(Tips: Removed 'Hide the scrollbar' subsection)
Line 117: Line 117:
you have to start a new xterm window to see the changes.
you have to start a new xterm window to see the changes.
===Hide the scrollbar===
In order to hide xterm's scrollbar, add the following to your .Xresources/.Xdefaults file.
xterm*scrollBar: off

Revision as of 12:27, 10 March 2013

xterm is the standard terminal emulator for the X Window System. It is highly configurable and has many useful and some unusual features.


Resource file settings

There are several options you can set in your X resources files that may make this terminal emulator much easier to use.

TERM Environmental Variable

Allow xterm to report the TERM variable correctly. Do not set the TERM variable from your ~/.bashrc or ~/.bash_profile or similar file. The terminal itself should report the correct TERM to the system so that the proper terminfo file will be used. Two usable terminfo files are xterm, and xterm-256color.

  • Without setting TERM explicitly, xterm should report $TERM as xterm. You can check this from within xterm using either of these commands:
$ echo $TERM
$ tset -q
  • When TERM is not set explicitly, color schemes for some programs, such as vim, may not appear until a key is pressed or some other input occurs. This can be remedied with this resource setting :
xterm*termName: xterm-256color


Make certain your locale settings are correct for UTF-8. Adding the following line to your resource file will then make xterm interpret all incoming data as UTF-8 encoded:

XTerm*locale: true

Fix the 'Alt' key

If you use readline's Template:Keypress, Template:Keypress and Template:Keypress at the command line, you will need this in your resource file:

XTerm*metaSendsEscape: true


As new lines are written to the bottom of the xterm window, older lines disappear from the top. The saved lines can be redisplayed by scrolling. By default, 1024 lines are saved. You can change the number of saved lines with the saveLines resource,

Xterm*saveLines: 4096

Other X resources that affect scrolling are jumpScroll, set to true by default, and multiScroll and fastScroll, both of which default to false.

The Scrollbar

The scrollbar is not shown by default. It can be made visible by a menu selection, by command line options, or by setting resource values. It can be made to appear to the left or right of the window and its visual appearance can be modified through resource settings.

The scrollbar operates differently from what you may be accustomed to using.

  • To scroll down:
– Click on the scrollbar with the left mouse button.
– Click on the scrollbar below the thumb with the middle mouse button.
  • To scroll up:
– Click on the scrollbar with the right mouse button.
– Click on the scrollbar above the thumb with the middle mouse button.
  • To position text, moving in either direction:
– Grab the thumb and use "click-and-drag" with the middle mouse button.


The Archlinux version of xterm is compiled with the toolbar, or menubar, disabled. The menus are still available as popups when you press Template:Keypress within the xterm window. The actions invoked by the menu items can often be accomplished using command line options or by setting resource values.

Tip: If the popup menu windows show only as small boxes, it is probably because you have a line similar to this, xterm*geometry: 80x32, in your resources file. This does start xterm in an 80 column by 32 row main window, but it also forces the menu windows to be 80 pixels by 32 pixels! Replace the incorrect line with this:
xterm*VT100.geometry: 80x32

Some of the menu options are discussed below.

Main Options menu

Ctrl + LeftMouse

  • Secure Keyboard attempts to ensure only the xterm window, and no other application, receives your keystrokes. The display changes to reverse video when it is invoked. If the display is not in reverse video, the Secure Keyboard mode is not in effect. Please read the "SECURITY" section of the xterm man page for this option's limitations.
  • Allow SendEvents allows other processes to send keypress and mouse events to the xterm window. Because of the security risk, do not enable this unless you are very sure you know what you are doing.
  • Log to File – The log file will be named Xterm.log.hostname.yyyy.mm.dd.hh.mm.ss.XXXXXX. This file will contain all the printed output and all cursor movements. Logging may be a security risk.
  • The six Send *** Signal menu items are not often useful, except when your keyboard fails. HUP, TERM and KILL will close the xterm window. KILL should be avoided, as it does not allow any cleanup code to run.
  • The Quit menu item will also close the xterm window – it is the same as sending a HUP signal. Most users will use the keyboard combination Template:Keypress or will type exit to close an xterm instance.

VT Options menu

Ctrl + MiddleMouse

  • Select to Clipboard – Normally, selected text is stored in PRIMARY, to be pasted with Template:Keypress or by using the middle mouse button. By toggling this option to on, selected text will use CLIPBOARD, allowing you to paste the text selected in an xterm window into a GUI application using Template:Keypress. The corresponding XTerm resource is selectToClipboard.
  • Show Alternate Screen – When you use an a terminal application such as vim, or less, the alternate screen is opened. The main VT window, now hidden, remains in memory. You can view this main window, but not issue any commands in it, by toggling this menu option. You are able to select and copy text from this main window, then paste into the alternate screen or another application. Using the alternate screen may take some trial and error experimentation.
  • Show Tek Window and Switch to Tek Mode – The Tektronix 4014 was a graphics terminal from the 1970s used for CAD and plotting applications. The command line program graph, from plotutils, and the application gnuplot can be made to use xterm's Tek emulation; most people will prefer more modern display options for charting data.

VT Fonts menu

Ctrl + RightMouse

  • When using XLFD fonts, the first seven menu items will change the font face and font size used in the current xterm window. If you are using an Xft font, the font face will not change with the different selections, only the size.
Tip: Unreadable and Tiny are useful if you wish to keep an eye on a process but do not want to devote a large amount of screen space to the terminal window. For example, a long compile operation where you only want to see if and when the compilation completes.
  • Selection allows you to switch to the font name currently stored in $PRIMARY (or $CLIPBOARD).


Automatic transparency

Install the package transset-df and a composite manager like Xcompmgr.

Add the following line to your ~/.bashrc:

[ -n "$XTERM_VERSION" ] && transset-df -a >/dev/null

Now, each time you launch a shell in an xterm and a composite manager is running, it will become transparent. the test in front of the transset-df command keeps it from executing if that variable is not defined. Note that your terminal will not be transparent if you launch a program other than the shell this way. It is probably possible to work around this if you want the functionality.

See Also

Enable bell urgency

Add the following line to your ~/.Xresources file:

xterm*bellIsUrgent: true

Remove black border

Xterm has a black border in some cases, you can disable this by adding the following line to your ~/.Xresources file.

xterm*borderWidth: 0

Change background and font color

First you make an Xresource file which is a regular textfile and it is described at X resources. You find a color you like at http://www.colorpicker.com/ and copy the 6 alphanumerical above the picture. Then to change your background you add

xterm*background: #<alphanumeric>

and for the font you add

xterm*foreground: #<alphanumeric>

Notice the casing on xterm. It did not work for me with XTerm or Xterm. Also after you make changes and do

xrdb -merge /path/to/Xresources


xrdb /path/to/Xresources

you have to start a new xterm window to see the changes.