• @[email protected]
      link
      fedilink
      358 months ago

      usr does mean user. It was the place for user managed stuff originally. The home directory used to be a sub directory of the usr directory.

      The meaning and purpose of unix directories has very organically evolved. Heck, it’s still evolving. For example, the new .config directory in the home directory.

      • JATth
        link
        fedilink
        16
        edit-2
        8 months ago

        For example, the new .config directory in the home directory.

        I hope slowly but surely no program will ever dump its config(s) as ~/.xyz.conf (or even worse in a program specific ~/.thisapp/; The ~/.config/ scheme works as long as the programs don’t repeat the bad way of dumping files as ~/.config/thisconfig.txt. (I’m looking at you kde folks…) A unique dir in .config directory should be mandatory.

        If I ever need to shed some cruft accumulated over the years in ~/.config/ this would make it a lot easier.

          • @[email protected]
            link
            fedilink
            48 months ago

            It kind of makes sense on many BIOS/UEFI-less systems where e.g. Uboot is used. And it does contain things like kernel images, sometimes initRD files etc. (which may not be bootloader files but are still system boot files).

            • @[email protected]
              link
              fedilink
              11
              edit-2
              8 months ago

              It’s not wrong, but it feels a bit like some tech articles you’ll see which are obviously just created to fluff up a CV. I wouldn’t say avyttring here is flat out wrong, just kinda… lacking.

              But yeah, /boot holds “system boot loader files”, sure, but that’s a bit vague. It should contain your kernel and initramcpio and IIRC Grub also had its config here. That’s pretty much it. I would’ve rather said /boot contains the kernel.

              “device files” it’s so vague that it’s almost wrong IMO. At first glaze I would’ve thought that it means drivers rather than, say, “interfaces to devices”

          • @[email protected]
            link
            fedilink
            18 months ago

            Well that’s a shame for me. This graphic finally made the Linux file directory structure make sense to me

    • @[email protected]
      link
      fedilink
      English
      28 months ago

      It meant user, as in user-installed programs and libraries for this system over the core system programs and libraries of the operating system in /bin and /lib.

      Someone learned it wrong, but otherwise I think the image is right.

      • @[email protected]
        link
        fedilink
        18 months ago

        It’s probably the standard in both POSIX and the Single UNIX Specification, so I guess ask Ken Thompson?

      • @[email protected]
        link
        fedilink
        118 months ago

        Is there a historical reason?

        If you’re asking that in anything Linux related, it’s probably a Yes 99% of the time LMAO

      • @[email protected]
        link
        fedilink
        Deutsch
        28 months ago

        Try naming a folder “CON” in Windows and learn the magic of old spaghetti code by a multi billion dollar company.

      • Random Dent
        link
        fedilink
        English
        228 months ago

        According to this, it’s been around since the 70’s and was originally just a catch-all for files that didn’t fit in the other default directories, but over time has come to be mostly used for config files. I assume it would cause utter mayhem to try and change the name now so I guess it just sticks. Someone suggested “Edit To Configure” as a backronym to try and make it make more sense if that helps anyone lol.

  • FQQD!
    link
    fedilink
    English
    2308 months ago

    i always thought /usr stood for “user”. Please tell me I’m not the only one

    • @[email protected]
      link
      fedilink
      English
      168 months ago

      It’s always been for USeR binaries. It’s the first time I’ve seen this bizarre backronym (40 years of Unix here).

    • @[email protected]
      link
      fedilink
      198 months ago

      I think it originally did under old Unix, it was what /home is nowadays; “Unix System Resources” is a backronym.

    • @[email protected]
      link
      fedilink
      398 months ago

      I thought it was United System Resources.
      And I still don’t know what’s the point in separating /bin, /sbin, /usr/bin and /usr/sbin.
      Also /mnt and /media
      Or why it’s /root and not /home/root

      • @[email protected]
        link
        fedilink
        148 months ago

        They hold “system binaries” meant for root user. It’s not a hard distinction but many if not most Linux fundamentals have their roots in very early computing, mainframes, Bell and Xerox, and this good idea has been carried into the here&now. Not sure about the provenance of this one, but it makes sense. isn’t /mnt /media different between distros? These aren’t hard and fast rules - some distros choose to keep files elsewhere from the “standard”.

        /bin and /usr/bin, one is typically a symbolic link to another - they used to be stored on disks of different size, cost, and speed.

        https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s16.html

        https://unix.stackexchange.com/questions/5915/difference-between-bin-and-usr-bin

      • @[email protected]
        link
        fedilink
        English
        48 months ago

        /sbin are system binaries, eg root only stuff, dunno the rest but I would guess there are some historical reasons for the bin usr/bin separation

        • @[email protected]
          link
          fedilink
          18 months ago

          I know the distinction between /bin and /sbin, I just don’t know what purpose it serves.

          Historically, /bin contained binaries that were needed before /usr was mounted during the boot process (/usr was usually on a networked drive).
          Nowadays that’s obsolete, and most distros go ahead and merge the directories.

          • @[email protected]
            link
            fedilink
            English
            78 months ago

            It’s easier to manage security that way.

            Instead of having one binary folder full of stuff that’s intended to be run with privilege access and non-privilege access, all the privileged stuff goes in sbin and you don’t even see it in your path as a regular user. It also means that access rights can be controlled at the folder level instead of the individual file level.

      • Magiilaro
        link
        fedilink
        208 months ago

        And I still don’t know what’s the point in separating /bin, /sbin, /usr/bin and /usr/sbin.

        This goes back to the olden days when disk space was measured in kilo and megabytes. /sbin/ and /usr/sbin have the files needed to start a bare bone Unix/Linux system, so that you could boot from a 800kb floppy and mount all other directories via network or other storage devices as needed.

        • @[email protected]
          link
          fedilink
          English
          28 months ago

          Is there a reason to keep this structure other than „we’ve always been doing it like that“/backwards compatibility?

          • Magiilaro
            link
            fedilink
            38 months ago

            The structure is changing, many distributions already are merging more and more of the duplicated subdirectories in /usr/ with the counterparts in / but it takes time to complete that and at the moment those subdirectories are often still there but as symlinks to be compatible with older software (and sysadmins).

      • Zeppo
        link
        fedilink
        English
        228 months ago

        /home is often on a separate volume. You’d want root to be available in a maintenance situation where /home may not be mounted.

        I don’t recall the reasons for the addition but /media is newer than /mnt.

        • @[email protected]
          link
          fedilink
          English
          108 months ago

          I don’t recall the reasons for the addition but /media is newer than /mnt.

          Something to do with hard-coded mounts in /etc/fstab vs. dynamically-mounted removable media (USB drives etc.), I think.

      • Magiilaro
        link
        fedilink
        428 months ago

        Mostly historical reasons, /home was often a network mounted directory, but /root must be local.

        And only regular users have their home in /home

        • @[email protected]
          link
          fedilink
          48 months ago

          Idk why I feel compelled to add this info, but / doesn’t have to be local as long as the necessary kernel modules for mounting it are available in the initrd or built into the kernel.

          • Magiilaro
            link
            fedilink
            78 months ago

            Yes, that is true. I was speaking in the context of very early Unix/Linux before initrd was a thing.

      • @[email protected]
        link
        fedilink
        68 months ago

        I think /mnt is where you manually mount a hard drive or other device if you’re just doing it temporarily, and /media has sub folders for stuff like cdrom drives or thumb drives?

        • @[email protected]
          link
          fedilink
          48 months ago

          Yeah, but why?
          You can mount a hard drive anywhere, and why not put all the cdrom and thumbdrive folders in /mnt, too?

          • Rose
            link
            fedilink
            88 months ago

            /mnt is meant for volumes that you manually mount temporarily. This used to be basically the only way to use removable media back in the day.

            /media came to be when the automatic mounting of removable media became a fashionable thing.

            And it’s kind of the same to this day. /media is understood to be managed by automounters and /mnt is what you’re supposed to mess with as a user.

          • Magiilaro
            link
            fedilink
            88 months ago

            It gets even more complicated nowadays because most DE will mount removable drives somewhere in folders like /run/$USER/

          • @[email protected]
            link
            fedilink
            English
            98 months ago

            /media is for removable drives. If you mount something there, file managers like Gnome will show you the “eject” or “disconnect” button.

            /mnt drives show up as regular network drives without that “eject” functionality.

            • @[email protected]
              link
              fedilink
              48 months ago

              I don’t know if I’m doing something wrong, but I have a secondary SSD in my laptop that I mount on /mnt/elyssa and in every DE and distro I tried it appeared as a removable drive with the “eject” button. Right now I use Fedora with Gnome and if I install this extension or enable the removable drives option in Dash to Dock, it shows me that drive. Maybe some mount option in Gnome Disks, but since it’s not that big of a problem, I haven’t looked too much into it.

    • @[email protected]
      link
      fedilink
      58 months ago

      I was just about to post the same thing. I’ve been using Linux for almost 10 years. I never really understood the folder layout anyway into this detail. My reasoning always was that /lib was more system-wide and /usr/lib was for stuff installed for me only. That never made sense though, since there is only one /usr and not one for every user. But I never really thought further, I just let it be.

    • @[email protected]
      link
      fedilink
      English
      38 months ago

      Likewise.

      It’s also only just now dawning on me /bin is short for /binaries. I always thought it was like… A bin. like a junk drawer hidden in a cupboard

    • @[email protected]
      link
      fedilink
      48 months ago

      Same. I actually feel like I remember the professor of my only unix class saying that. Hoping I’m wrong.

    • @[email protected]
      link
      fedilink
      768 months ago

      Ken Thompson and Dennis Ritchie created Unix on a PDP-7 in 1969. Well around 1971 they upgraded to a PDP-11 with a pair of RK05 disk packs (1.5 megabytes each) for storage.

      When the operating system grew too big to fit on the first RK05 disk pack (their root filesystem) they let it leak into the second one, which is where all the user home directories lived (which is why the mount was called /usr). They replicated all the OS directories under there (/bin, /sbin, /lib, /tmp…) and wrote files to those new directories because their original disk was out of space. When they got a third disk, they mounted it on /home and relocated all the user directories to there so the OS could consume all the space on both disks and grow to THREE WHOLE MEGABYTES. And thereafter /usr is used to store user programs while /home is used to store user data.

      source: http://lists.busybox.net/pipermail/busybox/2010-December/074114.html

  • Flamekebab
    link
    fedilink
    English
    38 months ago

    Is there a version of this that wasn’t awkwardly resized?

    • Deebster
      link
      fedilink
      18 months ago

      Is Gobo case-insensitive by default? Typing those seems annoying.

  • MrMobius
    link
    fedilink
    68 months ago

    Thank you for that, I always wondered about the meaning behind a few of these directories.

    • @[email protected]
      link
      fedilink
      128 months ago

      There’s a little historical baggage, but look at Windows: multiple letters for drives, and all of the paths can be modified, so you have to ask Windows where any important directory is physically mapped (like SystemRoot or Documents or Temp or Roaming AppData or many others), because it doesn’t have this nice consistent structure like Linux. Linux presents a logical layer and manages the physical location automatically. Windows makes you do the logical lookup yourself, but doesn’t enforce it, so inexperienced programmers make assumptions and put stuff where the path usually is.

      That’s part of why logging in to Windows over a slow connection can take forever if you have a bunch of Electron apps installed: they’ve mismapped their temp/cache directory under the Roaming AppData, so it gets synched at every login, often GiB of data, and they refuse to fix it.

      • @[email protected]
        link
        fedilink
        68 months ago

        I switched to Linux a few years ago and you are not wrong.

        Windows is a nightmare with directory organization.

        Saved games can go:

        • My Documents/
        • My Documents/Games
        • My Documents/My Games
        • <app>/saved-games
        • @[email protected]
          link
          fedilink
          78 months ago

          I’m more used to seeing shit like: c:/users/username/appdata/local/developer/game/engine/data3/saves/profile0/epe90_cats90-slot203.nonstandardfileformat

          • @[email protected]
            link
            fedilink
            58 months ago

            And then their non standard file format turns out to just be a zip file or gzipped JSON data 😂

  • @[email protected]
    link
    fedilink
    48 months ago

    /bin confused me for a while because I thought it meant ‘this stuff is trash, don’t worry about it’.

    • @[email protected]
      link
      fedilink
      English
      118 months ago

      It did, let me explain:

      On the original (ie Thompson and Ritchie at Bell in 1969-71), I think it was a PDP-11, they installed to a 512kb hard disk.

      As their “stuff” grew they needed to sprawl the OS to another drive, so they mounted it under /usr and threw OS components that didn’t fit.

      https://landley.net/writing/unixpaths.pdf

      I’ve done the same, outgrew so you mount under a tree to keep going, it just never became a historical artifact.

    • @[email protected]
      link
      fedilink
      228 months ago

      It is, this infographic is wrong. Or I guess technically some other standard could define it like the infographic, but the Filesystem Hierarchy Standard defines it as a secondary hierarchy specifically for user data.

      • @[email protected]
        link
        fedilink
        English
        5
        edit-2
        8 months ago

        /usr used to be the user home directory on Unix…well most of them. I think Solaris/SunOS has always been /export/home as I recall.

    • @[email protected]
      link
      fedilink
      28 months ago

      Huh. I did as well. Like /use/bin was for user installed applications and such. You learn something everyday.

  • wvstolzing
    link
    fedilink
    378 months ago

    A pedantic thing to say, surely, but the title really should’ve been: “Linux Directory Structure” – ‘Linux filesystems’ (the title in the graphic) refers to a different topic entirely; the title of this post mitigates the confusion a bit, though still, ‘directory structure’ is the better term.

    • guillermohs9
      link
      fedilink
      38 months ago

      Sure but for example I understand that /dev and /proc are actually kind of filesystems on their own

    • @[email protected]
      link
      fedilink
      208 months ago

      To be more pedantic the correct title would be the Filesystem Hierarchy Standard (FHS)…which describes the directory structures

  • Sonotsugipaa
    link
    fedilink
    English
    208 months ago

    It feels like /opt 's official meaning is completely lost on developers/packagers (depending on who’s at fault), every single directory in my /opt belongs to standalone software that should just be put into either /usr/lib or /usr/share with some symlinks or scripts into /usr/bin.

    • NonWonderDog [he/him]
      link
      fedilink
      English
      1
      edit-2
      8 months ago

      No, they have it right. Add-on software means “added to this node/machine”, as in not part of the system image used to configure multiple machines. It’s all very archaic.

    • Psyhackological
      link
      fedilink
      28 months ago

      I’ve also seen creating there deployment or configuration stack of your choice.