48

Say I have created a bash script, which will make an ftp user, mount some paths for that user, etc. Where in the file system it would be proper to place? It would be good to have some resource clearly explaining the file system hierarchy.

1 Answer 1

71

A Google search for "Linux file system hierarchy" will turn up several documents, including this one.

Where you put your script depends on who the intended user is. If it is just you, put it in ~/bin and make sure ~/bin is in your PATH. If any user on the system should be able to run the script, put it in /usr/local/bin.

Don't put scripts you write yourself in /bin or /usr/bin. Those directories are intended for programs managed by the operating system.

3
  • 7
    Here is a direct link to the home of the documentation. Sep 6, 2010 at 8:37
  • 6
    I'm using Ubuntu and found that ~/bin will be automatically included in your $PATH once the folder is created. There are lines in .profile: if [ -d "$HOME/bin" ] ; then PATH="$HOME/bin:$PATH" fi
    – Kenneth L
    Aug 26, 2014 at 9:11
  • 2
    Thanks! For others as inexperienced as me: (1) you either need to log out and back in after creating ~/bin , or run source ~/.profile before ~/bin gets added to your PATH (2) you also have to run chmod u+x ~/bin/<your script> to give yourself privilege to execute it.
    – WillC
    Apr 6, 2017 at 0:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .