The xterm seems to not read the colors I set in my ~/.Xresources file when I connect to a Linux PC remotely.

Basically, if I'm sitting in front of my PC and I run an xterm from Xsession, the colors will obey whatever is in my ~/.Xresources file - no problem there. Here is my ~/.Xresources file:

XTerm*background: black
Xterm*XtDefaultBackground: black
Xterm*XtDefaultForeground: white
XTerm*foreground: white

But if I log on to that same computer remotely and run an xterm (which will appear locally though), the colors are again the default (black fonts on white background).

It seems irrational that xterm does not read .Xresources file in this case! What am I missing?


The resources are stored in the X server - this is to prevent need for distributing the configuration files across several computers. .Xresources was never meant to be read by the applications, it is loaded into the X server with xrdb (although the situation is slightly more unclear when it comes to the older .Xdefaults, AFAICT). See wikipedia article for explanation.

That said, your remote XTerm tries to get its resources from your local X server, probably doesn't find them and resorts to defaults (which is black text on white background). Either load the desired settings with xrdb -merge into your Xserver or use XTerm options to achieve the desired effect: xterm -bg black -fg grey

As a side note: if you are running xterm remotely, chances are that a terminal multiplexer (e.g. tmux or screen) running on the remote machine might do you a better service.

  • hi there, i have tried the latter, but i lose all $LS_COLORS gui-ness if i hardcode the colors with -bg & -fg). I have copied the .Xresources file between the 2 computers and i still get the problem. xterm doesn't even read the local Xeserver .Xresources file. Finally i tried running xrdb -merge and then xterm and it works! thank you – nass Dec 31 '12 at 14:35
  • 1
    @nass As I mentioned, .Xresources is not scanned by X applications. .Xdefaults might be (at least under some circumstances). On a related note, keeping application settings under (distributed) version control might help you - you can easily get it to multiple machines (just by cloning a repository) - the only thing one needs to take care of is ensuring that the files end up where applications expect them - usually by symlinking (which in turn can be done by a script packed in the repository). – peterph Dec 31 '12 at 15:11

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.