Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

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.

share|improve this answer
    
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
    
@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

 
discard

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.