What is $PATH
?
How can I have commands/programs which are only available for me?
I have seen this path ~/bin
mentioned before, but what is it used for, and how do I use it?
environment-variables
What is $PATH
?
How can I have commands/programs which are only available for me?
I have seen this path ~/bin
mentioned before, but what is it used for, and how do I use it?
Best Answer
$PATH is an environment variable used to lookup commands. The ~ is your home directory, so ~/bin will be /home/user/bin; it is a normal directory.
When you run "ls" in a shell, for example, you actually run the /bin/ls program; the exact location may differ depending on your system configuration. This happens because /bin is in your $PATH.
To see the path and find where any particular command is located:
To have your own private bin directory, you only need to add it to the path. Do this by editing ~/.profile (a hidden file) to include the below lines. If the lines are commented, you only have to uncomment them; if they are already there, you're all set!
Now you need to create your ~/bin directory and, because .profile is run on login and only adds ~/bin if it exists at that time, you need to login again to see the updated PATH.
Let's test it out: