I started using uxterm instead of Gnome's terminal today. I put settings for uxterm in ~/.Xdefaults. But because Ubuntu's configuration ignores my .xsession file, I can't have these settings loaded at login. How can I get Unity (or lightdm) to run .xsession? My .xsession is recognized and run by XMonad.

  • BTW, a hack is a .xprofile that runs .xsession. – user91091 Feb 13 '13 at 17:25
up vote 9 down vote accepted

~/.xsession is only used when no X session is selected. Use ~/.xsessionrc to run programs at startup.

As using ~/.Xdefaults is obsolete, Ubuntu, like about any other modern X environment, uses ~/.Xresources at startup (see for example here for some reasons). So if you put your settings in ~/.Xresources you don't need to run xrdb as Ubuntu is doing this for you.

See /etc/X11/Xsession and /etc/X11/Xsession.d/* if you want to know more about what Ubuntu is doing when you start a X session.

  • Thanks! moving .Xdefaults to .Xresources solved my problem. And thanks again, for other useful tips. – user91091 Feb 13 '13 at 17:45

A note: in Ubuntu 12.03 .xsessionrc is also ignored

to solve it:



at the beginning, add


this is the final content:

# This file is sourced by Xsession(5), not executed.

#Source user defined xsessionrc (locales and other environment variables)
if [ -r "$USERXSESSIONRC" ]; then

I don't know if it's solved in versions >12.04

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.