According to the answer to What are login and non-login shells? on Ask Ubuntu, GNOME Terminal is a type of non-login shell. As pointed out in the excellent book, A Practical Guide to Fedora and Red Hat Enterprise Linux, 6th Edition:

an interactive non-login shell executes commands in the ~/.bashrc file. The default ~/.bashrc file calls /etc/bashrc.

As a result, /etc/profile won't be processed in a non-login shell. However, I found that I have appended the java home path to the PATH variable and, when I use GNOME Terminal and issue the command java, everything goes fine. Also, the value of the PATH variable is the same as the value I defined in /etc/profile.

In view of the above-mentioned facts, there is a conflict, what’s wrong with my understanding?


3 Answers 3


When you log in to your x session via a display manager or in a tty, /etc/profile is (usually - apparently it is being in your case, though some graphical shells do not read it) sourced by your shell program. After that, a local file (I'm assuming you're using bash here) ~/.bash_profile, ~/.bash_login or ~/.profile will be sourced, and any environment variables defined here will override /etc/profile for the current user. This environment is inherited by any shell you open within the session. This is why we can define environment variables, such as your PATH, in these files.

When you open gnome-terminal, yes by default that starts a non-login shell, but it inherits your user environment already loaded from the login shell or graphical shell. Since ~/.bashrc is sourced when starting an interactive shell (eg opening gnome-terminal), it may be used to override some elements of the environment (such as PS1).

(gnome-terminal itself is an application, not a shell)

  • Do you have a reliable document that contain the detail you mentioned?
    – LoremIpsum
    Sep 5, 2016 at 15:48
  • I learned this from The Linux Command Line. I can find the relevant section in the pdf copy I have, but I don't think it's online... I will look for another source... @BlueSteel
    – Zanna
    Sep 5, 2016 at 15:55

short: no

long: gnome-terminal is a terminal. You run a shell in a terminal. You can run either type of shell (login or not) in a terminal (though gnome-terminal makes it harder than other terminals).

Further reading:


Try this, it works in BASH.

shopt -q login_shell && echo " <<< It's a Login Shell >>> " || echo " <<< It's \"NOT\" a Login Shell >>> "

By the way, Gnome Terminal is just a terminal emulator(an application program) that uses shell(more specifically BASH).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .