Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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 have a few separate programs installed, some of which require me to go into my GUI terminal settings and enable/disable the "Run command as a login shell" option to get either working.


I installed Ruby on Rails. Unfortunately I have to go into the terminal options and enable "Run command as login shell" for it to be in my PATH.

This wasn't too much of an issue up until I installed sexy-bash-prompt, which works only if the option is disabled.

So my question is essentially: what does "Run command as login shell" do? Is there a way to get the things that run when it's disabled to run when you do run as login shell?

share|improve this question
up vote 19 down vote accepted

Assuming that your shell is Bash (the default in Ubuntu), these are the differences:

  • When running as a login shell, Bash will read ~/.bash_profile (or, if that doesn't exist, ~/.profile) on startup. In some cases, this file reads ~/.bashrc as well.

  • When running as a non-login shell, Bash will read ~/.bashrc.

So, why do you see different behaviors when running as a login/non-login shell? Because your .bash_profile/.profile is doing different things than your .bashrc.

The solution I would recommend in your case is to copy the customizations made to .bash_profile/.profile, paste them into .bashrc and disable "Run command as a login shell".

share|improve this answer
Ahh ok. I figured it had to do with what login profile it read (source'ing .bashrc fixes some of the issues I had). I'll give that a go, sorry for the horribly written question. – Dropped.on.Caprica Aug 26 '13 at 15:06
Great answer, very informative. – Travis Bear Nov 7 '13 at 23:40
Thanks for the concise explanation. It is not uncommon to see people just keep their customizations in .bashrc and have .bash_profile to source .bashrc. Login specific customizations should be kept in .bash_profile only. – MichaelZ Apr 15 '15 at 13:44
Why not just source .bashrc into .bash_profile and leave the login shell on? Is that feasible? – Dr. Nefario Jun 7 at 17:12

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.