Why isn't .profile sourced when opening a terminal?
- Because terminals don't usually run login shells by default. They also usually have options to run login shells, which do source
.profile
. - To control the behaviour of login shells.
- Depends on the shell. For
bash
, see the set of startup files. - Not in some sense (updating login records, for example).
- If you have a folder called
bin
in$HOME
, the default.profile
for Ubuntu does add it to yourPATH
. Since.profile
is sourced at login (even with a GUI login), it should be part of yourPATH
for non-login shells started after a re-login. It isn't wrong if a directory appears twice inPATH
, see this U&L question for details.
I found I had to edit the Default profile. In the terminal, click Preferences > Profiles > Edit > Command > Run command as login shell
Afterwards new terminals would source .profile script.