35

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.

53

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.

| improve this answer | |
  • 6
    Here is a direct link to the home of the documentation. – Paused until further notice. Sep 6 '10 at 8:37
  • 4
    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 '14 at 9:11
  • 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 '17 at 0:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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