Where do you normally keep your UNIX/Linux scripts?

There are numerous scripts that I have written for my server. Some of them are in my ~/scripts and some of them are in application directories.

I am just wondering is there a directory that you would normally use to keep your shell scripts?


Solution 1:

Personal ones for my account, ~/bin. System-wide ones go in /usr/local/bin or /usr/local/sbin as appropriate (scripts which should only be run as root go in sbin, while scripts intended to help ordinary users go in bin), rolled out via configuration management to ensure that all machines that need them have them (and the latest versions, too).

Solution 2:

For more complex stuff, especially something that could be shared between multiple machines I tend to make distribution packages, Debian in my case. I use /usr/bin, and give scripts some common prefix. That way it's easier to deploy and keep track of them. For my personal stuff, ~/bin is good enough.

Solution 3:

At the moment I use ~/bin for my personal (quick and dirty :P) scripts and /usr/local/bin (or sbin) for system wide ones

Both directories are under revision control via git.

Solution 4:

I currently use /usr/local/$company/scripts for system-wide scripts, and ~/bin for personal. I also have a ~/code folder that contains work-in-progress stuff.