I have my own shell script files and I want to run them in terminal, keeping them in /usr/bin
folder. But my question is: which directory is best for keeping files of my own script? I want to use this files when I call my script in Terminal. /opt
, /usr/local
, e.t.c. Which is the best choise?
Add a comment
|
1 Answer
$HOME/bin
is probably a good place if you want to call them without directory prefix. That folder is in your path so you can run your scripts like if they were installed in /usr/bin
for example.
But you can place them wherever you want, to keep your directory structure organised and optionally add those folders to PATH
aswell.
-
yes, I know, my script files are in /usr/bin. I want to know where I must keep my necessary files/folders which my script works on them? May 5, 2013 at 9:51
-
2@ZiyaddinSadigov You can use
~/.config/myfiles
for those files and access them in your script with$XDG_CONFIG_HOME/myfiles
. May 5, 2013 at 9:57 -
2For system-wide scripts I'd recommend
/usr/local/bin
(user) or/usr/local/sbin
(root only). It would be a pain to link/copy them in all user's home directories. May 5, 2013 at 10:17 -
@gertvdijk thanks, nice comment! You say that further files I can keep in /usr/local/bin? Script will work with files in /usr/local/bin? May 5, 2013 at 10:34
-
1@ZiyaddinSadigov See your path (execute
echo $PATH
) and you'll see. May 5, 2013 at 10:41