Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 have a fresh install of Ubuntu Natty. I changed my shell to zsh.

When I login, it does not appear to source my ~/.zprofile file. Does gnome not get executed in a login shell of your chosen shell? Is it always sh?

I went digging in /etc/gdm and found that gdm always sources ~/.profile if it exists, but I couldn't find anything that suggested it was doing anything specific to my chosen shell.

Can anyone help me understand what's going on here?

share|improve this question

GDM (version 2, I'm not sure about 3) only reads /etc/profile, ~/.profile, /etc/xprofile, and ~/.xprofile. Everything is run with sh.

A possible solution is to use ~/.xprofile and source it from your ~/.zprofile if you do not want to duplicate stuff in multiple files. Remember that ~/.xprofile is sourced from sh so you can't use any zsh syntax or commands in it.

share|improve this answer

The login shell only affects text mode sessions (i.e. when you type your password in text mode, or when you log in remotely), not graphics mode session (i.e. when you type your password in the GUI).

To have a single file for login-time definitions, put everything in ~/.profile, and source that from ~/.zprofile. An easy way is to make your ~/.zprofile contain the single line

emulate sh -c '~/.profile'

Gdm arranges to load ~/.profile as part of the session setup, so you're fully covered.

See also Zsh not hitting ~/.profile.

share|improve this answer
KDM actually executes the session in your chosen shell, so everything you would expect to load, does. In this sense, I think GDM is doing the "wrong thing". – Jeremy Cantrell May 17 '11 at 15:04
@Jeremy After having looked at KDM, I can assure you its doing things "the wrong way" even if it might be a good idea. – Arrowmaster May 19 '11 at 10:22
What's your justification for that? – Jeremy Cantrell May 20 '11 at 0:16

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.