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
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.
-
7
-
6I'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
Aug 26, 2014 at 9:11 -
2Thanks! 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 runchmod u+x ~/bin/<your script>
to give yourself privilege to execute it.– WillCApr 6, 2017 at 0:28