I work a lot with vim and decided to switch to cli version, I chose xterm because its the only terminal I know of that properly recognizes Alt shortcuts (and I have lots of those bound in vim).

My problem is that xterm doesn't load config file on startup. I have it in .Xresources file in my home directory (I also tried moving the contents of it to .Xdefaults but to no avail). When I type xrdb .Xresources it loads all the settings normally, also typing xrdb -query -all shows up proper terminal settings. I tried including that line in .xinitrc file and Openbox autorun (I work in Crunchbang distro where it is main window manager) but it doesn't work either.

Can anyone point me in the right direction on how to fix that?

My .Xresources file looks like this:

!XTerm*termName: xterm-256color
!UXTerm*termName: xterm-256color

! Colors

*background: #181818
*foreground: #c0c0c0
*cursorColor: #93a1a1

!! black dark/light
*color0: #121212
*color8: #2e3436

!! red dark/light
*color1: #a35b66
*color9: #ab6b74

!! green dark/light
*color2: #99ab6f
*color10: #acb972

!! yellow dark/light
*color3: #ca9733
*color11: #ccaa69

!! blue dark/light
*color4: #495d6e
*color12: #687987

!! magenta dark/light
*color5: #825969
*color13: #977381

!! cyan dark/light
*color6: #839191
*color14: #98a4a4

!! white dark/light
*color7: #e0e0e0
color15: #e5e5e5

*multiClickTime: 500
! Use a nice truetype font and size by default... 

! Every shell is a login shell by default (for inclusion of all necessary environment variables)
xterm*loginshell: true

! I like a LOT of scrollback...
xterm*savelines: 16384
UXTerm*faceSize: 8
UXTerm*cursorBlink: true
! double-click to select whole URLs :D
xterm*charClass: 33:48,36-47:48,58-59:48,61:48,63-64:48,95:48,126:48

! right hand side scrollbar...
xterm*rightScrollBar: false
xterm*ScrollBar: false

! stop output to terminal from jumping down to bottom of scroll again
xterm*scrollTtyOutput: false

Check what files xterm processes when you run it. Typically these include:


Check the output of strace xterm to get a full list for your system.

My guess is that you need to ln -s ~/.Xdefaults ~/.Xdefaults-$(hostname).

You also might want to tidy up your .Xdefaults file in two ways:

  1. pick a caps style and keep it consistently
  2. use prefixes like xterm* or VT100* throughout the settings

A good idea also might be creating a simple .Xdefaults file contining just #includes for per-application Xresources, i.e.:

#include <path/to/XTerm.xresources>
#include <path/to/UXTerm.xresources>
#include <path/to/whatever_else.xresources>

since it scales better.


A setting like *background: #181818 applies to all background colors in all widgets in all applications that use X resources. However, if an application has an explicit setting for its widgets somewhere, this more specific setting overrides the general setting *background. In practice, a general setting like *background is not useful.

All entries in ~/.Xresources should start with the class name of the application. This is usually the program name with initial caps. For xterm (including xterm with Unicode support, unless you're running an antique), the class name is XTerm. So change your ~/.Xresources to

XTerm*background: #181818
XTerm*foreground: #c0c0c0
XTerm*cursorColor: #93a1a1

If this still doesn't take effect, try a more specific setting that explicitly lists the widget you want to change:

XTerm.VT100.background: #181818
XTerm.VT100.foreground: #c0c0c0
XTerm.VT100.cursorColor: #93a1a1

If you use xterm (lowercase) instead of XTerm, then the settings only apply when you run a program (xterm or any other) with the instance name xterm, but not when you run e.g. xterm -name foo.

Oh, and don't set loginShell: that runs a login shell in each terminal, which causes more trouble than it solves. Your environment variables need to be set for your whole session anyway, not in each terminal.

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.