I recently purged my display manager in favor of starting xsessions with startx. I did this after setting up a new installation of ubuntu 18.04.

Up to now I was used to use ~/.pam_environment to set up environment variables for a user. For example I add my ~/bin path to PATH like this:


In the new system this doesn't seem to be recognized anymore. So what would the best place to define user specific environment variables?

My startx setup works like this:

Using zsh as login-shell, my ~/.zlogin file contains something like:

if [ $(tty) = "/dev/tty3" ]; then
    exec startx -- :3 vt3 &>/dev/null

And ~/.xinitrc something like:

xsetroot -cursor_name arrow
exec xmonad

Since you are using zsh on ubuntu the ~/.zshenv is the correct place for exported variables like $PATH, $EDITOR, ... (This doesn't work on Arch linux)

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.