this post was submitted on 06 Sep 2024
446 points (95.0% liked)

Linux

47237 readers
3343 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
446
Linux File System (telegra.ph)
submitted 1 week ago* (last edited 1 week ago) by [email protected] to c/[email protected]
 
top 50 comments
sorted by: hot top controversial new old
[–] [email protected] 121 points 1 week ago (8 children)

i always thought /usr stood for "user". Please tell me I'm not the only one

[–] [email protected] 35 points 1 week ago

You're not the only one 😅 🙋

[–] [email protected] 30 points 1 week ago (8 children)

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] 26 points 1 week ago (1 children)

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

And only regular users have their home in /home

load more comments (1 replies)
[–] [email protected] 15 points 1 week ago (1 children)

/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] 4 points 1 week 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.

[–] [email protected] 10 points 1 week 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] 7 points 1 week 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] 5 points 1 week ago (4 children)

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?

load more comments (4 replies)
load more comments (3 replies)
[–] [email protected] 24 points 1 week 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

[–] [email protected] 11 points 1 week ago

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

[–] [email protected] 4 points 1 week ago

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

[–] [email protected] 4 points 1 week ago

Yup same. I always wondered why there was a user folder when we already have home.

[–] [email protected] 4 points 1 week 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.

load more comments (1 replies)
[–] [email protected] 64 points 1 week ago (1 children)

"Linux File Systems"

*List of root directories*

Uh, where are the file systems? EXT4... BTRFS... FAT32...

[–] [email protected] 19 points 1 week ago

That’s what I thought too. This is directory structure, not file systems.

[–] [email protected] 42 points 1 week ago (2 children)

I don’t get why this sort of picture always gets posted and upvoted when it’s wrong for most distros nowadays.

[–] [email protected] 6 points 1 week ago (1 children)

Can you recommend one that is correct? I use pop_os (Ubuntu) and Arch. Kinda curious about either one

[–] [email protected] 7 points 1 week ago* (last edited 1 week ago) (2 children)

Not aware of any correct pictures, but I can tell you what's wrong with this one

  • /usr: explaining it as "Unix System Resources" is a bit vague
  • /bin: /bin is usually a symlink to /usr/bin
  • /sbin: /sbin is usually a symlink to /usr/sbin, distros like Fedora are also looking into merging sbin into bin
  • /opt: many, I'd say most, "add-on applications" put themselves in bin
  • /media: /media is usually a symlink to /run/media, also weird to mention CD-ROMs when flash drives and other forms of storage get mounted here by default
  • /mnt: i would disagree about the temporary part, as I mentioned before, stuff like flash drives are usually mounted in /run/media by default
  • /root: the root user is usually not enabled on home systems
  • /lib: /lib is usually a symlink to /usr/lib

I would also like the mention that the FHS standard wasn't designed to be elegant, well thought out system. It mainly documents how the filesystem has been traditionally laid out. I forget which folder(s), but once a new folder has been made just because the main hard drive in a developer's system filled up so they created a new folder named something different on a secondary hard drive.

[–] [email protected] 4 points 1 week ago

Thanks for this. I'm always confused by the layout and this tend to stick to putting things in the same places, even if they're wrong :)

load more comments (1 replies)
[–] [email protected] 5 points 1 week ago

It seems handy when you're learning about stuff but only when you haven't learned enough to realize it's not correct.

[–] [email protected] 30 points 1 week ago (3 children)

A good first approximation.

So where in this setup would you mount a network share? Or am additional hard drive for storage? The latter is neither removable nor temporary. Also /run is quite more than what this makes it seem (e.g. user mounts can be located there), there is practically only one system path for executables (/usr/bin)...

Not saying that the graphic is inherently wrong or bad, but one shouldn't think it's the end all be all.

[–] [email protected] 6 points 1 week ago (2 children)

I do /volumX for additional hard drives.

For most network share I use /mnt/$server.

[–] [email protected] 7 points 1 week ago

For most network share I use /mnt/$server.

I use /mnt/$proto/$server, though that level of organization was probably overkill. Whatever...

I do /volumX for additional hard drives.

[–] [email protected] 5 points 1 week ago

Or /home/me/drive

[–] [email protected] 4 points 1 week ago

I'm gonna blow everyone's mind.... I have my Linux system in a relatively small 4gb drive, and my home in a 4Tb drive. I mount my 4tb drive to /home/me as someone already said.

If my SSD for my OS takes a shit as people say, all you do is install it again, change fstab to swap the home directory and you're back in business like nothing happened. That's like 10 minutes install time on a good SSD these days. The other guy who mentioned this, didn't point this out. The idea of separating my home folder into its own drive didn't occur to me for years and years of using Linux. Every wrong update I was there copying home like a total windows 11 noob. I also install my extra drives and shares on /mnt, that's standard.

[–] [email protected] 3 points 1 week ago

On debian when i mount an ftp server through my file browser it uses gvfs

This will mount it to /run/user/1000/gvfs/ftp:host=,port=,user=

[–] [email protected] 22 points 1 week ago* (last edited 1 week ago) (1 children)
load more comments (1 replies)
[–] [email protected] 20 points 1 week ago (1 children)

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.

load more comments (1 replies)
[–] [email protected] 18 points 1 week ago (1 children)

/opt/(app)/bin /usr/lib/(app)/bin /usr/lib64/app/bin /usr/local/(s)bin

I know there is logic and mapping of where everything's supposed to be in theory but in practice s***'s kind of all over the place.

[–] [email protected] 7 points 1 week ago

The logic was just that when UNIX was originally evolving, they ran out of disk space on their PDP-11 and had to start moving less-essential binaries to a different disk. That's why it's "/usr/" which was originally for user data but that disk happened to have free space.

Any other explanation is just retcon. Some distros try to simplify things.

[–] [email protected] 17 points 1 week ago

Those are directories, not filesystems.

[–] [email protected] 9 points 1 week ago* (last edited 1 week ago)

This is the FHS layout, which is one of the common layout style for Unix-like OSes, and it has nothing to do with Linux or filesystems in general. Misleading information. GoboLinux has what they call the GoboLinux hierarchy layout, that adheres to NeXTSTEP or BeOS. Nix and Guix has the Store hierarchy layout, wherein, everything is contained inside a store directory. Filesystems include FAT16, FAT32, exFAT, BTRFS, Bcachefs or EXT1/2/3/4, just to mention a few examples.

[–] [email protected] 8 points 1 week ago

Fun fact: you get more accurate info by simply running man hier

[–] [email protected] 7 points 1 week ago (1 children)

I have always wondered why there was a developer folder(/dev)

Now i know that the government is trying to make people think it stands for something else so they can replace all programmers with advanced random number generators

[–] [email protected] 6 points 1 week ago (1 children)

Also /lib is where some people keep discarded capitalists

load more comments (1 replies)
[–] [email protected] 5 points 1 week ago (2 children)

Just forwarded this pic to my dad. I'll be guiding him in installing Mint on one of his old Windows desktops this coming Saturday! Wish us luck in the coming years 😂

[–] [email protected] 3 points 1 week ago

This image is misinformation. That's not a filesystem, that's a layout standard called the FHS. Filesystems are FAT32, BTRFS, EXT4, etc.

[–] [email protected] 3 points 1 week ago

Y’all got this! Good luck 🍀

[–] [email protected] 5 points 1 week ago* (last edited 1 week ago) (1 children)

Why is /mnt a "temporary" mounting point? I alwags put my permanent ones there. I'd say /media is temporary...

load more comments (1 replies)
[–] [email protected] 4 points 1 week ago

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

[–] [email protected] 4 points 1 week ago (1 children)

immuatables be all about /var

load more comments (1 replies)
[–] [email protected] 4 points 1 week ago

If my /bin contains exe files, something has gone very wrong somewhere...

Also, all these infographics are a sad casualty of the /usr/bin merge.

[–] [email protected] 4 points 1 week ago

Linux file system is ext* tho.

[–] [email protected] 4 points 1 week ago (1 children)

Visualizing it like this makes it so clear how incredibly outdated this design is.

[–] [email protected] 3 points 1 week ago

What is outdated?

load more comments
view more: next ›