8.9 /lib, /usr, /opt, /srv: Libraries, User Hierarchy, Add-Ons, Services

Right, let’s talk about where your system actually puts all its stuff. You’ve probably poked around in the root directory (/) and seen a bunch of these cryptic folders. They’re not there by accident (well, mostly). They follow a grand, ancient blueprint called the Filesystem Hierarchy Standard, or FHS. It’s the reason you can, generally, expect to find libraries in /lib and not, say, in /where_did_i_put_that. We’re going to crack open four of the most commonly misunderstood ones: /lib, /usr, /opt, and /srv.

8.8 /dev: Device Files — Block, Character, and Special Devices

Right, let’s talk about /dev. You’ve probably seen it, a directory full of what look like files with weird names like sda, ttyS0, and null. They are files, but they’re not files in the way you and I usually think about them. They’re not containers for data you wrote. They’re more like magical portals. Opening and writing to one of these files doesn’t hit a disk; it talks directly to a piece of hardware, or a software abstraction so fundamental the kernel provides it.

8.7 /proc and /sys: Virtual Kernel Interfaces

Right, let’s talk about two of the most useful and most misunderstood directories on your system: /proc and /sys. You’ve seen them, you’ve probably been told not to touch them, and you’ve maybe even peeked inside. They look like regular directories, but they’re not. They’re a live, dynamic, and utterly fascinating view into the kernel’s soul. Think of them as the kernel’s debug console and control panel, magically mapped into your filesystem because, well, it was the most clever way the designers could think of to let user-space programs interact with it.

8.6 /tmp and /run: Ephemeral Runtime Data

Right, let’s talk about the two directories on your system that are designed to be forgotten: /tmp and /run. They’re the digital equivalent of a whiteboard—incredibly useful for scribbling down a thought, but you’d be horrified if that scribble became a permanent fixture on your wall. They hold data that only matters right now. The key difference between them is a question of ownership: is this temporary data for you, the user, or for the system and its services?

8.5 /var: Variable Data — Logs, Spools, and Databases

Right, let’s talk about /var. If / is the root of your system’s universe and /usr is the pristine, read-only library of software, then /var is the messy, bustling, constantly-changing workshop where the actual work gets done. The name stands for “variable,” and it’s where anything that grows, shrinks, or changes on its own accord lives. Think of it as the system’s scratch paper, its inbox, its ledger, and its diary, all rolled into one.

8.4 /home and /root: User Home Directories

Right, let’s talk about where you live. No, not your physical house—your digital one. On a Linux system, your personal slice of the universe is /home/your_username. It’s your bedroom in the sprawling mansion of the operating system: you get to put posters on the walls, leave dirty socks on the floor, and generally arrange things as you see fit. The system and other users (mostly) have to knock before coming in.

8.3 /etc: System-Wide Configuration Files

Right, let’s talk about /etc. Forget the urban legend that it stands for “Et Cetera”—it doesn’t. It’s just the name. This is the directory where your system goes to get its marching orders. If your Linux machine were a person, /etc would be its personality, its habits, and all the little rules it lives by. This isn’t for your data or your programs; this is for the system’s configuration. And it’s a glorious, sometimes horrifying, mess of text files.

8.2 /bin, /sbin, /usr/bin: Essential User and System Binaries

Right, let’s talk about the three bins in the room: /bin, /sbin, and /usr/bin. You’ve seen them. You’ve probably used them without a second thought. But why are there three places for what is essentially the same thing: executable programs? The answer is a delightful mix of historical baggage, practical necessity, and a few decisions that make you wonder if the designers were running on a serious caffeine deficit. It all boils down to one question: “What do you absolutely need to boot and repair a system when your /usr partition is sitting on a network drive that hasn’t mounted yet, or is corrupted beyond recognition?” This isn’t a theoretical question. I’ve been there, staring at a initramfs prompt, thanking my lucky stars that ls, mount, and fsck were still available. That’s the core of the split.

8.1 / (Root): The Top of the Hierarchy

Right, let’s talk about /. No, not your website’s root directory. This is the real root. The one directory to rule them all. Forget C:\ from Windows; that’s just a drive letter. Here, / is the absolute, unequivocal starting point for every single file and directory on the system. It’s the cosmic singularity from which the entire universe of your OS expands. If a file’s path doesn’t start with a /, it’s relative to wherever you currently are. If it does, the system knows exactly where to go, no matter what.

— joke —

...