1

If I am correct, I remember that opening a new tab in genome terminal will run .bashrc, and opening a new gnome terminal window also will.

Do these two read the same init files of bash?

E.g. ~/.bashrc, not ~/.bash_profile?

Thanks.

terdon
  • 100,812
Tim
  • 25,177

1 Answers1

1

Yes. Opening a new tab or a new terminal does exactly the same thing: it launches a new instance of your $SHELL (bash by default) in interactive, non-login mode. What this means is that the following files are read:

/etc/bash.bashrc
~/.bashrc

If you start a login shell, bash will read /etc/profile, and the first of these it finds: /.bash_profile, ~/.bash_login, and ~/.profile. This is all explain in the Invocation section of man bash:

When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. The --noprofile option may be used when the shell is started to inhibit this behavior.

[...]

When an interactive shell that is not a login shell is started, bash reads and executes commands from /etc/bash.bashrc and ~/.bashrc, if these files exist.

For more details on the various files sourced or executed under different conditions, see my answer here.

terdon
  • 100,812