Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I don't have a desktop manager installed (and I don't want to). After logging in through the terminal I use startx to start the GUI. I have entries in ~/.xinitrc for my GUI sessions. Right now I have xmonad in there, but sometimes I want to run a GNOME session, and sometimes a KDE session. I used to edit ~/.xinitrc for that purpose, but I think there should be a more elegant way (something like using alternate configurations). However, I can't find anything in man startx or man xinit.

I plan to have several configuration files (one for each GUI session), and then tell startx to load them when I want. How can I do that?

share|improve this question
up vote 12 down vote accepted

According to the xinit man page that I read, xinit (and thereby startx) looks in its command line parameters for a client program to run. If it doesn't find one, it runs ~/.xinitrc instead. So you should be able to write

startx path/to/my_alternate_xinitrc

and it will do what you want. You will need to provide a path, though, and not just a filename. In my testing, startx ./my_xinitrc worked but startx my_xinitrc did not.

share|improve this answer
The file name thing is weird, anyway this answer works for me, thanks! – phunehehe Jan 23 '11 at 12:08

Your Answer


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.