5

Where is the correct place to store user-local executable files?

echo $PATH gives

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

It doesn't include eg. $HOME/bin

Would $HOME/bin be advisable? Or $HOME/opt/bin ....

I guess I would have to add that to my .profile too?

  • Do not change anything, just mkdir ~/bin, log out and log back in and it'll be there. – Sergey Sep 20 '12 at 21:07
  • Be sure to make all directories in you PATH non-writable, as writable bin directories are a major security hole. – Vladislav Ivanishin Sep 20 '16 at 16:11
8

I think if you add a $HOME/bin directory it should be added to the path automatically, looking in my .profile would indicate this

Yes just checked and by creating a $HOME/bin directory the next time you log in its automatically added to the path.

Hope that helps

  • 2
    BTW if you jut created this folder you will need to source .profile file in order to make new adde binary to be availible using $PATH : # source ~/.profile – micrub Feb 12 '14 at 15:07
4

Based-on what you are describing, I'm thinking that you should install your executables to /usr/local/bin/.

Here is an answer to a similar question that backs-up this assessment: What is the best place to install user apps?

Otherwise, you certainly could create a ~/bin directory and add it to your path. IMO that is a viable solution if those apps will/should be used only by your user. But you will run into some security headaches if another user has a need for those apps later on.

  • 2
    I share my laptop, on which I am hacking, with my wife. she will probably never need on of my executables. Thank's for your security concerns though! – JohnDoe Sep 21 '12 at 5:44

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