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?

1 Answer 1


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".

  • 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. Aug 26, 2013 at 15:06
  • 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, 2015 at 13:44
  • 2
    Why not just source .bashrc into .bash_profile and leave the login shell on? Is that feasible? Jun 7, 2016 at 17:12

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.