Linux Filesystem Hierarchy (2004)
tldp.org
tldp.org
... which is referenced in hier(7) https://man7.org/linux/man-pages/man7/hier.7.html
... which is itself referenced in file-hierarchy(7) https://www.freedesktop.org/software/systemd/man/latest/file... (which is the first place I look things up these days).
These days seems Red Hat is deciding what the Hierarchy is instead of the community.
https://www.haiku-os.org/docs/userguide/en/filesystem-layout...
This shows you what Linux could be if it were redesigned from scratch without layers of patches/fixes. Nice, simple, and due to dynamically mounted read only package system, read-only actually means read only.
What relationship is there between home folders and the boot process?
...but Linux has chroot, symlinks, hardlinks, and everything in-between - it's entirely possible to design a Linux environment where the clutter and warts of back-compat are only visible to the users and programs that need to see them.
"For example, StarOffice, Kylix, Netscape Communicator and WordPerfect packages are normally found here"
~/... is for your personal user account
/bin (and /usr/bin, /sbin, /usr/sbin ) is for system software (from your distro of choice)
and /opt is for third party packages from third party providers
we tend to forget the "Unix" precursor of Linux comes from the data centre server world.
so "a mess" is relative
Don't most/popular distros symlink many of those together?
(Not sure if popularity matters.)
"back in the days" before there was an initrd you needed a small disk. that was /bin and /sbin. into that disk some /etc/rc.d/ file would mount a separate /use partition (and /home and /opt), often from network.
however with pivot_root and initrd we don't need that dance any more and do another one...
likewise the distinction between sbin and bin is gone.
that's why they today just symlink together.
Indeed. When I first encountered Unix back in the Dark Ages, not only was it common to be working on the same machine with a dozen other people simultaneously, we also had an environment where many programs were hosted on NFS filesystems, and we would have paths like /usr/nfs/alpha-dec-osf1 for Alpha binaries, /usr/nfs/decstation-ultrix for MIPS binaries, /usr/nfs/sparc-sun-solaris, etc. You would make sure your profile scripts included the right architecture path.
Even modern UNIXes (like Darwin/MacOS) include write(1), if you want to start a chat with someone else logged into your MacBook, I suppose.
https://specifications.freedesktop.org/basedir-spec/basedir-...
/usr/bin belongs to the package manager for your distro. Don't put anything there.
/usr/sbin is the same but house executables that should only be run by root.
/bin and /sbin are analogous but house the minimal set that needs to be present during early boot in case /usr is on a separate partition. In practice, distros have largely moved to making at least /bin and /sbin symlinks to /usr/bin and /usr/sbin, with some making everything else a symlink to /usr/bin.
/usr/libexec holds executables installed by the package manager but meant to be run only by other programs, not by interactive users.
/usr/local/bin and /usr/local/sbin hold executables installed manually rather than by the package manager. By convention, the package manager should never touch this and it will be left alone during system upgrades. In theory, it holds executables meant to be used by every user of a system, but if this is a desktop system with only one user, putting your personal stuff there is harmless.
Not part of the FHS, but according to cross-desktop group standards, ~/.local/bin is where you put executables meant to be used by a single user only. The package manager won't touch this directory, but third-party installers like pip and what not should theoretically be using it (not ~/.cargo/bin like cargo does).
/opt effectively serves a similar purpose to /usr/local, but for software that expects all of its dependencies to be hermetically contained within a single top-level directory rather than shared. This is often because /opt is mounted via NFS and shared across multiple hosts that might not all have the same common system-wide dependencies. I can't think of a whole lot of examples where this is still commonly used, except that Kubernetes puts the CNI plugins here.
Also, technically if you're booting via UEFI, then your bootloader or any other EFI executables should be at the root of your EFI system partition, which in Linux will usually be mounted at either /boot or /boot/efi depending on the distro, but users should rarely be messing with this unless you're doing Linux from Scratch or really know what you're doing. This also includes Linux itself in a Linux distro because the kernel is an EFI executable now thanks to EFISTUB and you don't actually need a separate bootloader if you really know what you're doing.
[0] https://wiki.gobolinux.org/Overview/GoboLinux-Filesystem-Hie...
I wonder if another UNIX at some point added such a user in order to reserve '/usr/bin'...
But I suppose it did not work out as people were hoping and only added to admin costs.
Still, I was a bit annoyed when I noticed everything was owned by root as opposed to bin when I first installed Slackware decades ago. But I got over it :)
Makes upgrades easier when leaving SysV init alone (in /bin).
http://lists.busybox.net/pipermail/busybox/2010-December/074...
This is how I set my $PATH, note this code is portable between several Linux distros (including NixOS), macOS, OpenBSD, FreeBSD, and amd64/arm64...
<https://github.com/rollcat/dotfiles/blob/52a634f/.profile#L1...>
Whenever I touch it, I just wish I could put PATH=/bin in there instead, but then I'd be stuck juggling 17 different ways to make bind mounts.
some differences:
* openbsd does not use a /boot/ partition. instead it uses the bsd.* files in root.
* no /proc/ in its entirety in openbsd. use sysctl(3) instead.
* current openbsd does not have a separate /var/tmp/; it is a symbolic link to /tmp/.
So there’s no equivalent to EFISTUB (the kernel as a UEFI executable, most easily accomplished by mounting the ESP at /boot)?
/mnt came first. and distros started mounting stuff into it. but actually it was never meant to be used for that. it was supposed to be an always empty directory where a sysadmin could mount something temporarily if they needed it.
so distros moved away from /mnt and started using /media
then /run was invented as a place for all that semi-automatic temporary stuff that needs a place while the system is running.
by looking at where a distro mounts stuff, you can see how long they have not bothered to follow changing standards.
personally i wish /media would have stuck. i find the current paths /run/media/username/device rather unpractical. whenever i connect a data device i have to go searching for the mountpoint.
giving sensible defaults to automatic mounts is the issue here.
:D
* It is hierarchical.
* It sorts by file type, not by namespace.
from gobolinux.org:
> GoboLinux is a modular Linux distribution: it organizes the programs in your system in a new, logical way. Instead of having parts of a program thrown at /usr/bin, other parts at /etc and yet more parts thrown at /usr/share/something/or/another, each program gets its own directory tree, keeping them all neatly separated and allowing you to see everything that's installed in the system and which files belong to which programs in a simple and obvious way.