This question already has an answer here:

I noticed that my path environment variable had the path for my home's binaries $HOME/bin.

I did not add $HOME/bin directory to my path environment variable so how did $HOME/bin get added to the path?


RE - 'possible duplicate':

This question is specific to the environment variable "PATH" and is further specific to how does a specific value, i.e. $HOME/bin, get appended to the environment variable.

The "possible duplicate":

  • does NOT mention the environment variable PATH anywhere in the question or answer
  • does NOT mention anything about $HOME/bin anywhere in the question or answer

marked as duplicate by goldilocks, Ulrich Schwarz, taliezin, jimmij, lcd047 Jul 13 '15 at 19:17

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.

  • The possible duplicate doesn't need to mention anything about PATH since it covers environment variables in general. – muru Jul 13 '15 at 18:04

on CentOS/RHEL 6.x (and up) and Fedora 20 (and up):

When you login, the script $HOME/.bash_profile is executed and this script adds $HOME/bin to your path.

on Ubuntu:

When you login, the script $HOME/.profile is executed and this script adds $HOME/bin to your path. (source: https://askubuntu.com/questions/49784/how-is-bin-added-to-my-path)

  • 2
    On Ubuntu $HOME/bin only gets added to the path when it exists so anyone adding it needs to make sure that .profile gets run again. – Paul Jul 13 '15 at 15:46

This is in /etc/skel/.profile and consequently in all users ~/.profile until changed.

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

True of Debian 6, therefore Ubuntu, and maybe others.

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