I'm running bash in Ubuntu, and I'm trying to run a computational chemistry program called Gaussian 16.  My colleague tells me that he is able to run Gaussian 16 by adding the following lines to his .bashrc file:

export g16root=/g16root
source $g16root/g16/bsd/g16.profile

My colleague says that once he adds those lines to his .bashrc file, he can run Gaussian 16 using the command g16 <input file>, where <input file> is the required input file.

My .bashrc file is in my home directory (~, in other words /export/home/myusername/).  When I add those above two lines to my .bashrc file and then attemptg16 <input file>, bash tells me it doesn't know what g16 is ("g16: command not found").

HOWEVER, if I execute (separately) those above two lines in bash (i.e., the above export and source commands), then bash knows what g16 is: g16 <input file> runs the software, and additionally, which g16 gives /g16root/g16/g16.  So this works, but I have to reenter the export and source commands every time I log in to the (remote) machine.

Please bear with me since I'm a bash novice, but how do I get bash to "execute" the export and source commands in my .bashrc file?

In case it's helpful, the entirety of my .bashrc file (other than commented lines) is now the following:

test -s ~/.alias && . ~/.alias || true

if [ -f /etc/bashrc ]; then
        . /etc/bashrc

export g16root=/g16root
source $g16root/g16/bsd/g16.profile

(I don't know why the first two blocks of code are there.)

Also, executing echo $BASH_VERSION gives 4.1.5(1)-release, so apparently I am actually using bash.

  • 1
    Put something like echo hello or touch ~/testfile in the .bashrc file to see if it even gets processed properly (Bash by itself doesn't read .bashrc for login shells, just the .profile files etc. Usually they'd also read .bashrc, but...) Also, run echo $BASH_VERSION to check that it's actually Bash you're running (and not ksh or zsh, or whatever)
    – ilkkachu
    Jan 14, 2022 at 22:07
  • 1
    The shell runs ~/.bashrc whenever you start an interactive shell. Merely adding the lines to the files won't do much. Starting a new terminal, or logging out and in again, will cause the shell to run the added lines.
    – Kusalananda
    Jan 14, 2022 at 22:17
  • I have started a new terminal and have logged out and in again. When I run echo $BASH_VERSION, the terminal gives 4.1.5(1)-release.
    – Andrew
    Jan 14, 2022 at 22:22
  • 1
    Just to be sure: it sounds a bit like you modify the local .bashrc when you need to modify the one on the remote server. Also: .profile should also source .bashrc (if BASH is detected as shell). And: How do you do the login?
    – FelixJN
    Jan 14, 2022 at 22:25

1 Answer 1


As stated by ilkkachu, .bashrc was not being processed for login shells -- only .profile was. (This behavior may be specific to Ubuntu; I'm not sure.)

I was able to induce .bashrc to be processed for login shells by adding the following lines to .profile:

# if running bash
if [ -n "$BASH_VERSION" ]; then
     # include .bashrc if it exists
     if [ -f "$HOME/.bashrc" ]; then
         . "$HOME/.bashrc"

You must log in to answer this question.

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