For gdm, at the top of /etc/X11/gdm/Xsession, there is PROGNAME=Xsession, so another solution is to add this condition before including ~/.bashrc in ~/.bash_profile :
# include .bashrc if it exists if [ "$PROGNAME" != "Xsession" -a -f ~/.bashrc ]; then . ~/.bashrc fi and create a link ~/.profile to ~/.bash_profile. -- .bash_profile is not sources when X session starts https://launchpad.net/bugs/66004 -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs