I'm just trying to follow this tutorial and set up my environment. My system is WSL Ubuntu 18.04. Here is already an answer on my question, but I as an absolute novice in Linux/UNIX don't know which variant presented there more suitable for my goal. Do I need to add this string
export PATH="$PATH:/path/to/dir"
into my ~/.profile or ~/.bashrc file?
Or may I need to accomplish the second step from the answer?
cd /usr/bin
sudo ln -s /path/to/binary binary-name
And then run these commands?
source ~/.profile
or
source ~/.bashrc
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 aterminal
window, and you can confirm the path by typingecho $PATH
.Update #1:
If you decide to use
~/.local/bin
anyway, add this to the end of your ~/.profile...Then log out, log back in, and your new path will be available.
The
PATH
variable gets changed when this shell command is executed: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 typeexport 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
.