Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

$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.

share|improve this answer
    
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? –  Ziyaddin Sadigov May 5 '13 at 9:51
2  
@ZiyaddinSadigov You can use ~/.config/myfiles for those files and access them in your script with $XDG_CONFIG_HOME/myfiles. –  Basharat Sialvi May 5 '13 at 9:57
2  
For 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. –  gertvdijk May 5 '13 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? –  Ziyaddin Sadigov May 5 '13 at 10:34
1  
@ZiyaddinSadigov See your path (execute echo $PATH) and you'll see. –  gertvdijk May 5 '13 at 10:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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