zlacker

Understanding the bin, sbin, usr/bin, usr/sbin split (2010)

submitted by csmant+(OP) on 2026-01-04 13:49:04 | 199 points 157 comments
[view article] [source] [go to bottom]

NOTE: showing posts with links only show all posts
3. cowlby+Dk[view] [source] 2026-01-04 16:02:47
>>csmant+(OP)
Obligatory XKCD Standards https://xkcd.com/927/
7. behnam+Cm[view] [source] 2026-01-04 16:12:40
>>csmant+(OP)
This is what happens when a system is designed by multiple people and companies over a long period of time. An amalgam of ideas which are there just because. There's no reason Linux should be like this. e.g., see https://gobolinux.org/ which has more sane dirs.
◧◩
9. rendaw+5n[view] [source] [discussion] 2026-01-04 16:14:53
>>roger_+Zk
It was partial, but IIRC Arch Linux made the switch to get rid of at least some of the directories previously: https://archlinux.org/news/binaries-move-to-usrbin-requiring...

Edit: Oh haha, this article was posted 13 years ago and there was a similar thread which is how I dug up that link... >>5944594

11. chrisw+qn[view] [source] 2026-01-04 16:16:33
>>csmant+(OP)
Ha! TIL. Funny and informative post.

Speaking of things which are needlessly complex, I'm reminded of this classic post on the tortured history of the browser User-Agent header:

https://webaim.org/blog/user-agent-string-history/

Highly recommended!

◧◩
35. forgot+5t[view] [source] [discussion] 2026-01-04 16:52:35
>>IgorPa+Vp
Basically: https://sta.li/filesystem/. Arguably /usr shouldn't exist because rather polluting system with unmanaged installations should be making a package and installing with package manager.
◧◩
36. markst+ot[view] [source] [discussion] 2026-01-04 16:54:08
>>behnam+Cm
Linux does not use this split any more. Many of these dirs were merged back together. The "/usr merge" was adopted by Debian, Ubuntu, Fedora, Red Hat, Arch Linux, openSUSE and other major distros:

https://itsfoss.gitlab.io/post/understanding-the-linux--usr-...

`man file-hierarcy` defines modern Linux filesystem layout.

https://www.man7.org/linux/man-pages/man7/file-hierarchy.7.h...

41. vxxzy+Gu[view] [source] 2026-01-04 17:01:00
>>csmant+(OP)
I am going to use this story in place of the "Pot Roast Principle" [0]

[0]: https://www.psychologytoday.com/us/blog/thinking-makes-it-so...

45. age123+Bv[view] [source] 2026-01-04 17:08:03
>>csmant+(OP)
Here [1] is a related trick in the old Unix to run either `foo`, `/bin/foo` or `/usr/bin/foo` (apparently before `PATH` convention existed):

    char string[10000];
    strp = string;
    for (i=0; i<9; i++)
        *strp++ = "/usr/bin/"[i];
    p = *argv++;
    while(*strp++ = *p++);

    // string == "/usr/bin/foo"
    execv(string+9, args); // foo (execv returns only in case of error, i.e. when foo does not exist)
    execv(string+4, args); // /bin/foo
    execv(string, args);   // /usr/bin/foo
[1] https://github.com/dspinellis/unix-history-repo/blob/Researc...
◧◩
47. loeg+5w[view] [source] [discussion] 2026-01-04 17:11:41
>>roger_+Zk
I think most of them have started simplifying somewhat (/bin vs /usr/bin): https://systemd.io/THE_CASE_FOR_THE_USR_MERGE/

(FWIW, Fedora 17 was released in 2012.)

62. codazo+PC[view] [source] 2026-01-04 17:50:33
>>csmant+(OP)
I wrote an article to remind myself which bin directory I prefer and why.

https://joeldare.com/where-i-put-personal-binaries-in-macos

◧◩
82. xaeris+dL[view] [source] [discussion] 2026-01-04 18:39:32
>>M95D+qx
This is busybox, not the general linux distros.

busybox in Alpine Linux has for example `ps` builtin. If you install ps with `apk add ps` to get the full version, it will remove the symlink for /bin/ps and replace it with the one you installed.

You need to read up on the purpose of busybox. It is not something that the kernel people has decided upon. It is an initiative of an group of people who needed some tools onto a single floppy.

/bin/ps on a Debian distro is 154522 bytes. The whole busybox in Alpine Linux is 804616 bytes and contains a whole lot more than just ps.

https://en.wikipedia.org/wiki/BusyBox https://busybox.net/

◧◩◪◨⬒⬓⬔⧯
99. Brybry+vO[view] [source] [discussion] 2026-01-04 19:02:33
>>schmuc+sE
Steam's original system requirements in the 2002 beta included Windows 98. [1]

They didn't stop advertising Win98 support until sometime in early 2007.

Granted, Steam back then was a different creature than Steam now.

[1] https://web.archive.org/web/20020605222619/http://www.steamp...

◧◩◪
104. M95D+UP[view] [source] [discussion] 2026-01-04 19:11:44
>>xaeris+dL
No, it's not (just) Busybox. Quotes from Gentoo: https://wiki.gentoo.org/wiki/Merge-usr

> merge-usr is a script which may be used to migrate a system from the legacy "split-usr" layout to the newer "merged-usr" layout as well as the "sbin merge".

> It is required for systemd ≥255 due to changes upstream, but it remains optional for other init systems.

◧◩
106. ajross+TQ[view] [source] [discussion] 2026-01-04 19:19:29
>>schmuc+3q
> Linux has no concept of a base system, it's a stand-alone kernel with a hodgepodge of crap around it

Good grief. How does this end up as the top comment on HN of all places? I'll bet anything that this author also thinks that systemd is way too opinionated and unified and that the system needs a less coupled set of init code.

Edit to be at least a tiny bit more productive: the Linux Filesystem Hierarchy Standard is about to pop the cork on its thirty second birthday. It's likely older than most of the people upvoting the post I responded to. https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard

To wit: that's outrageous nonsense, and anyone who know anything about how a Linux distro is put together (which I thought would have included most of the readers here, but alas) would know that.

◧◩◪◨
113. buzer+8U[view] [source] [discussion] 2026-01-04 19:37:37
>>IgorPa+SN
What is the source for that? Some of the oldest references to sbin I can find are 4.3BSD Net/2 man pages (https://man.freebsd.org/cgi/man.cgi?query=hier&apropos=0&sek...) and Filesystem Standard v1.0 (https://www.ibiblio.org/pub/Linux/docs/fsstnd/old/fsstnd-1.0...). Former doesn't mention anything about static binaries, latter only mentions that static ln (and even mentions sln being static version of ln) and sync can be useful.
◧◩◪◨
114. theand+QV[view] [source] [discussion] 2026-01-04 19:50:04
>>IgorPa+AN
/media has nothing to do with backups (though one could backup stuff there):

> This directory contains subdirectories which are used as mount points for removable media such as floppy disks, cdroms and zip disks. https://specifications.freedesktop.org/fhs/latest/media.html

/var is used for websites and databases, but defaults for most packages don't use /srv by default. (I have the feeling that /srv is relatively new.)

◧◩◪◨
119. mjg59+FZ[view] [source] [discussion] 2026-01-04 20:17:12
>>M95D+kS
https://www.freedesktop.org/wiki/Software/systemd/TheCaseFor..., for example
◧◩
133. xattt+Sq2[view] [source] [discussion] 2026-01-05 10:39:16
>>behnam+Cm
> There's no reason Linux should be like this. e.g., see https://gobolinux.org/ which has more sane dirs.

And I thought we just got over the systemd drama…

◧◩◪◨
139. argula+oB2[view] [source] [discussion] 2026-01-05 12:18:42
>>benchl+La2
Using /usr/bin instead of /bin comes down to that is much easier to mount one /usr instead of doing bunch of bind mounts for /bin /sbin /lib /lib32 /lib64,

Also some more background info https://systemd.io/THE_CASE_FOR_THE_USR_MERGE/

◧◩◪
151. JdeBP+ZN5[view] [source] [discussion] 2026-01-06 09:14:47
>>jmclnx+Yo
I really should write that "Yes, Virginia; executables once went in /etc." Frequently Given Answer.

Because it was /etc (and of course the root directory) where the files for system boot and system administration went in some of the Unices of yesteryear. In AT&T Unix System 5 Release 3, for example, /etc was the location of /etc/init, /etc/telinit, and /etc/login .

sbin is actually quite complex, historically, because there were a whole lot of other directories as well.

* https://jdebp.uk/FGA/unix-path-and-personalities.html

◧◩◪◨⬒
154. JdeBP+qT5[view] [source] [discussion] 2026-01-06 10:03:57
>>buzer+8U
There are no contemporary sources for that because it is, as it was called here on Hacker News some years ago, an 'ahistoric retcon'.

* >>31338349

The 's' is for 'static' version of the explanation of the name of sbin is not actually supported by any 20th century Unix doco. The books on AT&T Unix System 5 (before which, things were in /etc) that actually give an explanation for sbin all say system binaries, or system administration commands; and none of them says anything about linkage.

The 'static link' story came from Linux people years afterwards. Here's Ian McCloghrie correcting this misconception in a Linux discussion back in 1993:

* https://groups.google.com/g/comp.os.linux.development/c/EKzL...

I pointed out the origins of sbin some years ago.

* https://lists.debian.org/debian-user/2019/02/msg00041.html

[go to top]