Bash not loading ‘.profile’ in new session on Linux

.bash-profilebashbashrcshellterminal

I'm setting up a new Linux machine I got from our IT dept, and noticed .profile is not loaded when I start a new terminal session. The current shell is Bash, though I changed it from the default sh it came with. How do I make it load .profile on startup?

I access the shell via SSH: ssh myusername@remotemachine. I have administrator privileges on it.

Best Answer

When Bash starts as an interactive login shell, one of the files it may process is ~/.profile.

When it starts as an interactive non-login shell it doesn't. It processes /etc/bash.bashrc (if that file or a similar file is enabled in your version of Bash) and ~/.bashrc.

You could add the following to your ~/.bashrc (but be careful of loops or values being changed inadvertently):

. $HOME/.profile