How can I add ~/.local/bin to my PATH?
If you make a ~/bin
folder in your home folder, it'll already be in your default path. No need to modify anything, or add folders to a hidden .local folder. Create the ~/bin
folder, log out, log back in, and open a terminal
window, and you can confirm the path by typing echo $PATH
.
Update #1:
If you decide to use ~/.local/bin anyway, add this to the end of your ~/.profile...
# set PATH so it includes user's private ~/.local/bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$PATH"
fi
Then log out, log back in, and your new path will be available.
The PATH
variable gets changed when this shell command is executed:
export PATH=$PATH:/your/new/path
The ~/.bashrc
and ~/.profile
will be executed automatically when you open a bash session (normally when you open a new terminal window/tab).
So if you want to change the PATH
in current shell session only, you could just type export PATH=xxx
and execute it once. But if you want to make it difference permanently, you should add the command above into ~/.bashrc
or ~/.profile
.