Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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
@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
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
@ZiyaddinSadigov See your path (execute echo $PATH) and you'll see. – gertvdijk May 5 '13 at 10:41

Your Answer


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.