Best practice for storing custom commands (Unix)

filesystemsunix

I wish to know if there's any standard or recommended place to store your own custom commands (should you prefer not to install them in /usr/local/bin)?

I'm referring to small gimmicks that I, personally, don't prefer installing in /usr/local/bin for reasons such as, if I have to reformat my whole system and need to backup stuff, I won't be able to easily distinguish my own custom-made commands from the ones installed with package managers, etc.

I guess it might be up to personal choice to create something like /usr/local/mybin or similar, but is there a beaten path here that I'm not aware of? Your personal preference is also welcome.

Best Answer

The historically 'standard' place for your own binaries and scripts to go that you don't want to (or can't) install in /usr/local/[s]bin is ~/bin (i.e., the folder bin in your home directory).

You may need to add that folder to your $PATH environment variable in .bashrc, .profile or .cshrc etc depending on your shell.

Related Question