This question already has an answer here:

I thought that whatever lies in .bash_profile(or .profile) which is sourced in a login-shell, is available in an interactive shell.

My goal is to have available a list of functions, either in a login shell or in an interactive shell.

I am using Ubuntu 14.04.1, and i don't use .profile, but instead .bash_profile.(.profile has been renamed)

So currently what i have done, i have inserted the functions in .bash_profile, but when opening an interactive terminal they are not available, only if i use bash -l.

marked as duplicate by Gilles bash Jul 24 '16 at 20:16

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


Functions defined in .bash_profile are only available in the shell that reads .bash_profile and not available in sub shells.

When you open a terminal window you may be opening a non login shell. Some terminal programs may let you open a login shell (eg gnome-terminal has it at edit -> profile preferences).

However if you shell out of another program (eg run :sh from vi) then you won't see these functions.

Normally, however, functions and things you want set on every shell should be placed in .bashrc.

Not the answer you're looking for? Browse other questions tagged or ask your own question.