19

I'm not sure what's happened but my ~/.profile is no longer loading.

Can anyone see something wrong with the following?

export PS1="\u@local [\w]# "
export EDITOR="subl -w"
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced

alias vst="ssh -i ~/.ssh/vst root@vst"

I know for a fact using that PS1 like I am attempting to do it should be doing Peter@local [~/path/to/file]# but it's not.

Any ideas?

2 Answers 2

35

Does ~/.bash_profile or ~/.bash_login exist? If so, that'll be used instead of ~/.profile.

Sign up to request clarification or add additional context in comments.

3 Comments

I did in fact have a .bash_login. Copying the contents from there to .profile and removing bash_login fixed it. Thank you.
@Peter: the solution kenorb gave below (stackoverflow.com/a/29152555/499797) is a much better than copy pasting all information into the same file.
Stumbled on this thread when reverting from Mac OSX Catalina "upgrade" of zsh back to bash. Turns out ~/.bash_profile isn't used, and only ~/.profile is being sourced when using /bin/sh as default terminal now. Copy bash_profile to profile and your old sources will be available.
30

In Unix FAQ (for OS X) we can read:

Bash Startup Files

When a "login shell" starts up, it reads the file /etc/profile and then ~/.bash_profile or ~/.bash_login or ~/.profile (whichever one exists - it only reads ONE of these, checking for them in the order mentioned).

When a "non-login shell" starts up, it reads the file /etc/bashrc and then the file ~/.bashrc.

Note that when bash is invoked with the name sh, it tries to mimic the startup sequence of the Bourne shell (sh). In particular, a non-login shell invoked as sh does not read any dot files by default. See the bash man page for details.

So if you already have ~/.bash_profile, the file ~/.profile won't be automatically read by bash, therefore you can add the following lines in your ~/.bash_profile to load it:

# Load user profile file
if [ -f ~/.profile ]; then
  . ~/.profile
fi

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.