Please refer to the Filesystem Hierarchy Standard (FHS) for Linux for this.
/bin : For binaries usable before the
/usr partition is mounted. This is used for trivial binaries used in the very early boot stage or ones that you need to have available in booting single-user mode. Think of binaries like
/sbin : Same, but for scripts with superuser (root) privileges required.
/usr/bin : Same as first, but for general system-wide binaries.
/usr/sbin : Same as above, but for scripts with superuser (root) privileges required.
if I'm writing my own scripts, where should I add these?
Neither of the above. Please use
/usr/local/sbin for system-wide available scripts. The
local path means it's not managed by the system packages (this is an error for Debian/Ubuntu packages).
For user-scoped scripts, use
bin/ in your home directory.
The FHS says for
Tertiary hierarchy for local data, specific to this host. Typically has further subdirectories, e.g.,