I was just wondering - where do you usually put your shell scripts? or perl or python scripts for that matter?

Is /usr/local/scripts ok? or /opt ?

link|improve this question

3  
I think this is a pretty general question ('cause non-programming users, admins et. al. also have this problem) and am voting to migrate to Super User, but you might want to clarify what you mean by "keep". Are we talking about archiving them for the future or making them available for easy execution from the prompt (which seems to be what you answer are addressing)? – dmckee Nov 22 '10 at 16:28
feedback

migrated from stackoverflow.com Nov 22 '10 at 20:43

This question came from our site for professional and enthusiast programmers.

4 Answers

up vote 14 down vote accepted

I drop everything in $HOME/bin, and append it to my $PATH, by placing

PATH=$PATH:~/bin

in .bashrc.

link|improve this answer
feedback

For system-wide use, I would put them in /usr/local/bin. For per-account use, I'd put them in $HOME/bin as withoutasound suggests.

link|improve this answer
feedback

I have them in their own git repo. As soon as they are reasonably polished, I use a script to symlink them to ~/bin.

link|improve this answer
feedback

I put them in a dedicated directory under /var/tmp for at least three reasons:

  • It isn't related to any specific account
  • I can always (on regular Unix systems) create a directory there even without administrative rights
  • It normally survives a reboot

Of course, sometimes eager cleaning scripts wipe that directory off but I can easily reinstall it anyway.

For packaged stuff, I always used /opt/ as it is a standard. /usr/local/bin has several pitfalls.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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