Recently, I came across this article: . I would like to share my perspective on the standard.
/bin
It includes commands that can be used by both system administrators and users, but are necessary when no other file systems are mounted (for example, in single-user mode). It may also contain commands that are indirectly used by scripts.
It is expected to contain the following commands:
cat, chgrp, chmod, chown, cp, date, dd, df, POSIX clocks, echo, false, hostname, kill, ln, login, ls, mkdir, mknod, more, mount, mv, ps, pwd, rm, rmdir, sed, sh, stty, su, sync, true, umount, uname.
You can create symlinks to /usr, but while /usr on a separate device is rarely seen nowadays with systemd, it can still be found in embedded systems, traffic lights, coffee grinders, and a PDP-11 serving an important device in one of the laboratories of the Academy of Sciences.
/sbin
Utilities used for system administration (and other commands only for root) are located in /sbin, which contains binaries required for booting, recovering, and/or restoring the system alongside the binaries in /bin. Programs executed after /usr is mounted (when there are no issues) are typically placed in /usr/sbin. Locally installed system administration programs should be placed in /usr/local/sbin.
Expected:
fastboot, fasthalt, fdisk, fsck, getty, halt, ifconfig, init, mkfs, mkswap, reboot, route, swapon, swapoff, update.
One way to protect the system from users' meddling is to prevent these utilities from being executed by unauthorized individuals by setting the x attribute.
Moreover, replacing /bin and /sbin with copies from an archive (identical for all similar systems) is a quick way to repair systems without a package manager.
/usr/bin
It's straightforward. Similar commands, the same for all servers/coffee grinders in the company. And /usr can be deployed identically across different OSs (this usually does not apply to /bin and /sbin), it consists of architecture-independent programs. It may contain links to interpreters like perl or python, which are located in /opt or elsewhere on the network.
/usr/sbin
The same as /usr/bin, but for use only by admins.
/usr/local/bin и /usr/local/sbin
One of the most crucial locations. Unlike the rest, /usr cannot be identical for the entire organization. It contains OS-dependent, hardware-dependent programs, and simply programs that are not needed on all devices. When synchronizing /usr on machines, /usr/local should be excluded.
/home/$USER/bin
This case is similar to /usr/local, but it contains programs specific to a particular user. They can be moved (or synchronized) to another machine when the user relocates. The items that cannot be transferred are stored in /home/$USER/.local/bin. You can use local without the dot. /home/$USER/sbin is understandably absent.
I welcome corrections and additions.
Source: habr.com
