8 ms·
Linux Filesystem Hierarchy (2004)
- yrro 3y agoHm, not to be confused with the Linux Filesystem Hierarchy Standard: https://refspecs.linuxfoundation.org/FHS_3.0/fhs.html https://refspecs.linuxfoundation.org/FHS_3.0/fhs.html ... which is referenced in hier(7) https://man7.org/linux/man-pages/man7/hier.7.html 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-hierarchy.html https://www.freedesktop.org/software/systemd/man/latest/file... (which is the first place I look things up these days).
- deleted 3y ago[deleted]
- jmclnx 3y agoIsn't Red Hat/Fedora ignoring these standards ? I noticed /run is not even mentioned. I wish Linux would go back to what I consider a sane Hierarchy :) Similar to what OpenBSD has. These days seems Red Hat is deciding what the Hierarchy is instead of the community.
- 2OEH8eoCRo0 3y agoFedora isn't the "community"?
- taskforcegemini 3y agoit is run by RedHat, so no, not in this context
- da_chicken 3y agoAbout 2009 or 2010 I recall nearly every major distro saying they were going to ignore it, yes. It primarily existed so that Linux could mimic System V and/or POSIX, and that stopped being relevant as soon as software written for Unix migrated into software written for Linux.
- wichert 3y agoIt primarily existed to standardise paths between different Linux distributions. This, along with the LSB, was intended to make it possible to ship software that would work on all distributions.
- SAI_Peregrinus 3y agoIt did a pretty poor job of it though, since it made no attempt to separate distro software from third-party software (unless you count "shove everything 3rd-party in /opt and bundle all dependencies").
- nonameiguess 3y agoDo you mean in the FHS? /run is in there. It's runtime variable data, like /var but for data that doesn't need to persist between boots.
- irdc 3y agoI still think it’s funny how what used to be the location of user home directories, namely /usr, has been retconned to be where the majority of binaries are stored.
- sverhagen 3y agoI didn't know this. I had never seen it. I've used Linux for many years, but not an expert by any means. But it peeked my curiosity, and I found the explanation in this answer satisfying: https://askubuntu.com/a/135679 https://askubuntu.com/a/135679
- rollcat 3y agoThe story went something like, the guys building UNIX got a second hard drive, so they moved the home directories (/usr) to it. As the system grew, they started dropping more binaries into /usr/bin (while trying to keep /bin for things needed to boot/rescue the system, in case the disk with /usr failed). The rest is history.
- yrro 3y agoAnd to this day there is a mysterious 'bin' user on Linux systems that no one seems to use or know the purpose of. I wonder if another UNIX at some point added such a user in order to reserve '/usr/bin'...
- deleted 3y ago[deleted]
- mananaysiempre 3y agoAt least one old UNIX book of French origin described the “bin” user as the owner of the common binary files on the system.
- jmclnx 3y agoYes, that was what I remember. I think having bin own the binaries was a kind of security check for suids. Avoids having a suid on a root owned binary. Plus you could use bin to install programs instead of root. Restricting who has root access. 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 :)
- endre 3y ago> your file system got damaged so badly that the files were mutilated beyond recognition :D
- matheusmoreira 3y agoI love that sentence so much.
- smallstepforman 3y agoThe equivalent for Haiku OS, without decades of legacy, conflicts, changes, history, backwards compatibility: https://www.haiku-os.org/docs/userguide/en/filesystem-layout.html 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.
- Rygian 3y ago> "The home folder - /boot/home/" What relationship is there between home folders and the boot process?
- daaahhdekfbb 3y agoIt says it's the boot volume, not necessarily the equivalent I guess of /boot on Linux where it's exclusively for boot related things.
- terinjokes 3y agoYou may want to email HN (see https://news.ycombinator.com/newsfaq.html https://news.ycombinator.com/newsfaq.html) as it seems you're shadow banned.
- postmodest 3y agoThese are folders on the boot drive, which is always mounted on /boot?
- etskinner 3y agoThis seems like a bad choice. The home directory need not be on the boot drive. In fact, a lot of people put it on a separate drive, or at least a separate partition.
- ahoka 3y agoWith a proper redesign from scratch, it could have the same success and market share Haiku has.
- nishs 3y agocomplementary openbsd resource: https://man.openbsd.org/hier https://man.openbsd.org/hier 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/.
- rollcat 3y agoNote the (2004). Some things were removed/added/changed (/initrd, /sys, several things in /usr). Check <https://linux.die.net/man/7/hier https://linux.die.net/man/7/hier> for an up-to-date resource.
- ahoka 3y agoThe /proc equivalent in OpenBSD is ptrace(2).
- Retr0id 3y agoCould you elaborate? To me there seems extremely little overlap there (I'm familiar with both the procfs and linux's ptrace APIs, but not OpenBSD's ptrace).
- dun44 3y agoPtrace could an equivalent of what /proc was originally supposed to be, before it got repurposed for a bunch of sysctl-like purposes.
- Retr0id 3y agoInteresting. I didn't know much about /proc's original design intent, and Wikipedia indeed says "the design of procfs aimed to replace the ptrace system call used for process tracing", citing https://lucasvr.gobolinux.org/etc/Killian84-Procfs-USENIX.pdf https://lucasvr.gobolinux.org/etc/Killian84-Procfs-USENIX.pd... ("Processes as Files", USENIX 1984)
- 3y ago
- pkkm 3y agoSee also the GoboLinux filesystem hierarchy [0], which may be what would happen if we redesigned the traditional Unix hierarchy. [0] https://wiki.gobolinux.org/Overview/GoboLinux-Filesystem-Hierarchy/index.html https://wiki.gobolinux.org/Overview/GoboLinux-Filesystem-Hie...
- drexlspivey 3y ago/bin /usr/bin /usr/local/bin /sbin /usr/sbin /usr/local/sbin I never know where to put my own binaries so I just add my own at ~/bin. Some programs also add their own like ~/.cargo/bin what a mess
- froh 3y ago/usr/local is for all users of the multi-user server you're on, which you have installed locally. ~/... 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
- theandrewbailey 3y ago> /bin (and /usr/bin, /sbin, /usr/sbin ) is for system software (from your distro of choice) Don't most/popular distros symlink many of those together?
- NekkoDroid 3y agoMost distros use a mostly hermetic-usr, where a majority of "distro stuff" is shipped in /usr/{bin,sbin,lib,lib<bitness>,share}. The folders in root mostly symlink to these directories (/usr/sbin might also symlink to /usr/bin).
- yjftsjthsd-h 3y agoYes, ex. https://wiki.debian.org/UsrMerge https://wiki.debian.org/UsrMerge
- HankB99 3y agoYes https://www.freedesktop.org/wiki/Software/systemd/TheCaseForTheUsrMerge/ https://www.freedesktop.org/wiki/Software/systemd/TheCaseFor... (Not sure if popularity matters.)
- froh 3y ago
- readingnews 3y agoI actually like how the document dates itself, for example in the /opt description: "For example, StarOffice, Kylix, Netscape Communicator and WordPerfect packages are normally found here"
- _chu1 3y agoWhy does every distro mount USB mass storage devices differently? "/run/media" vs "/media/" vs "/mnt/"
- em-bee 3y agoevolution. /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.
- wichert 3y ago/mnt historically was used as a single mount point. This became problematic when it became common to have multiple temporary mounts, for example a CD-ROM and a USB stick. /media solved that by stating mountpoints are folders inside it, eg /media/cdrom.
- em-bee 3y agoright. what early distributions were doing was creating subdirectories within /mnt, but that got in the way when users wanted to mount something manually. at least it did bother me. 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.
- _chu1 3y agoThings lile this are why I use Windows daily. I can assign a specific USB mass storage device a letter it will always use and I memorize it.
- 3y ago
- nilslindemann 3y agoThe fundamental errors of this are: * It is hierarchical. * It sorts by file type, not by namespace.
- nishs 3y agoby namespace do you roughly mean package?
- nilslindemann 3y agoI mean spaces where we put things belonging to a name. When I look at the bin folder on my system, I am mostly: "what the heck are these?" If each of these binaries were in a folder, for example "Python" (that's the namespace), together with their sources, configuration, documentation, etc., I could easily explore this small aspect of the system.
- nishs 3y agosome linux distributions, such as GoboLinux (which, i think, was mentioned elsewhere in the comments, too), do this. 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.
- nilslindemann 3y agoThank you, very interesting!