Linux / OS Fundamentals Series

🎧 [Listen] The Linux/OS Fundamentals Series, Fully Recapped

This article is an audio-learning recap for anyone who’s already read all twenty-six articles in the Linux/OS Fundamentals series. Use your browser’s or phone’s text-to-speech feature and let it play in the background during a commute or while doing chores. There are no diagrams, tables, or code here — just spoken-style prose, stitching the whole series back together into a single, continuous thread.

The series opened with the daemon itself. A daemon is a process with no screen a user directly operates, running continuously in the background for as long as the OS is up, providing some specific role or service. The name doesn’t come from anything sinister — it traces back to the Greek idea of a guardian spirit, watching over and quietly working alongside you, and by convention its name usually ends in the letter d. Behind every server, these nameless guardian spirits just keep working, without ever stopping.

Next came the library — a file that bundles together, already compiled, the routines shared in common across multiple programs, so no single program has to reimplement that logic from scratch. The idea of packaging commonly used logic into a reusable component is universal across programming in general, but the word “library” specifically refers to something at the level of the OS and the build system: that component is delivered as its own independent file, and gets pulled into another program through the process of compiling and linking.

From there we went deeper, into the divide at the very foundation of the OS: user space and kernel space. Kernel space is the privileged territory where the OS’s core work — hardware control, memory management, process scheduling — actually runs. User space is where ordinary applications run, with direct hardware access deliberately restricted. Keeping these two strictly separated exists for one essential reason: so that a bug or a crash in an ordinary application can never directly destroy the OS as a whole, or the hardware underneath it.

Next we covered permissions — a mechanism we run into constantly without ever really thinking about it. A Linux file’s permissions express, for every single file, who can do what, encoded as nine bits of information, checked by the kernel every single time an access request comes in. “Who” breaks into three categories — owner, group, other. “What” breaks into three kinds — read, write, execute. Three times three gives you nine bits, and those nine bits are the entire foundation.

Next came SELinux — an entirely separate, one-layer-higher access control, completely independent of this permission system (DAC). In an SELinux-enabled environment, fully opening up the DAC side with chmod 777 still leaves access denied if the MAC side’s policy denies the combination of labels assigned to the process and the file. These two checks are independent, so widening one doesn’t lift the other’s denial. If you ever hit “widening permissions doesn’t fix it,” the move is restorecon, resetting the label to its correct value — don’t forget that disabling SELinux itself sacrifices the defense.

Next came the difference between hard links and symbolic links. A filename isn’t actually the file’s substance itself — it’s just a label pointing at an inode, the file’s real substance. A hard link adds one more, perfectly equal label pointing at the same inode, with no distinction over which one’s the original. A symbolic link, meanwhile, is an independent file with its own inode, whose only content is a path string. With this understanding, you can immediately explain the phenomenon of deleting a log file that somehow never frees up disk space — it’s simply that a process still holding that file open is keeping the link count from ever reaching zero.

Next came inode exhaustion. Every file consumes exactly one inode regardless of size, and the total count gets fixed the moment the filesystem is created, never increasable afterward. Keep creating a huge number of small files, and df -h can still show plenty of free data area while df -i’s IUse% hits 100%, leaving you unable to create a single new file. Don’t forget: a group of files that are small but extremely numerous, like PHP session files or mail queues, is the typical cause.

Then came procfs, a slightly strange entity. procfs is a virtual filesystem — nothing about it actually exists on disk; the kernel generates its contents on the spot, the instant something accesses it. Within it, the region the kernel consults for its tuning parameters while running presents those values as if they were files — read one and you get the current value; write to one and the kernel’s actual internal value changes, immediately, on the spot. The sysctl command and the config file are really nothing more than a convenient front end for reading and writing that.

From there the story moved to iptables. The iptables command isn’t the program that actually processes rules — it’s strictly a configuration tool for registering rules with netfilter, the packet-filtering mechanism inside the Linux kernel, saying “when a packet like this shows up, handle it like this.” The kernel itself is what actually inspects every single packet and decides whether to accept or drop it, and once the iptables command finishes running, it has no further involvement whatsoever. The command is only ever the messenger; the kernel is always the one doing the work.

Next we sorted out directory structure — a foundation we rarely stop to think about. Linux’s directories follow an industry-standard convention, and at its backbone sit two axes: is this data specific to this one host, or generic data that can be shared and reused across multiple machines? And is it static data that never changes once installed, or mutable data that gets rewritten during operation? The reason configuration files have a fixed, conventional home isn’t mere habit — it’s because, sorted along those two axes, they land in a clear, specific position: host-specific, mutable data that a human edits by hand.

One topic in this series was especially tied directly to real-world work: how a config file actually “takes effect.” A config file, on its own, has no power to execute anything at all. It only “takes effect” because a separate program — a daemon — exists to read it, interpret it, and translate it into actual behavior. The config file is nothing more than input data as far as the daemon is concerned. Only once that file has been opened, read, its contents parsed, held in the program’s own internal data structures, and actually applied to real work does the configuration truly, meaningfully “take effect.”

Next came an extremely common real-world phenomenon: a cron job that “should work but fails.” A script that runs fine manually can fail silently once registered in crontab. The real cause was that cron never goes through files like .bashrc that a login shell loads, running the job with only a minimal set of environment variables, something like PATH=/usr/bin:/bin. You confirmed this invisible difference with your own eyes, by writing out the env command’s output from both an interactive shell and a cron job and comparing them. And don’t forget: by default, cron never displays standard output or standard error anywhere, so without explicit redirection, an error truly is lost in silence.

Next came the journalctl command. journalctl is the search command for the “journal” — a binary-format log store managed by systemd. Instead of grepping through a plain-text file, you can filter structured logs directly by service name, time range, priority level, or originating process. This command, standing at the front line of troubleshooting, actually rests on the foundation of everything the rest of this series covered.

Stepping a bit sideways from there, we covered the true nature of the curl command. curl is a tool for assembling and sending an HTTP request from the command line and receiving the response back, and we mapped its options for viewing the status code and headers, specifying the method, and sending a body onto the exact part of an HTTP request each one corresponds to. And don’t forget the key fact: curl itself isn’t a standalone tool at all — it’s a thin wrapper calling a library called libcurl, which an enormous number of programming languages call directly behind the scenes. A request you’ve already verified locally with the curl command is effectively a dry run for the same request your application code will make later — keep that perspective in mind.

Next came the true nature of the word “framework.” A framework and a library both let you reuse code someone else wrote, but the thing that genuinely separates them is which direction control flows. A library is something your own code calls as a component, whenever it needs to, staying firmly in control. A framework is the reverse — the framework itself holds control, calling your code as a component at a moment it decides. A runtime is the actual ground code stands on to run at all. An SDK is a toolbox bundling that ground together with a set of components. And an API isn’t a piece of software at all — it’s simply the contract for how to call something. Once you know these five words each operate on a different dimension, you can join a technology-selection debate without getting lost.

From there came a hands-on lab about tracking down a file or directory yourself with the find command. Instead of relying on a written guide, you guess what’s likely stored somewhere from a file or directory’s name, and narrow it down by combining conditions like name, type, and modification time. The real point was that the instinct for making a good guess, built on knowing directory-structure conventions, matters more than the find tool itself.

From there, we dug into the construct that shows up in hands-on articles as a given: combining the cat command, a redirection symbol, and the string EOF. It turned out to be a combination of two independent mechanisms — redirection and a here document. Redirection switches the output destination from the screen to a file, and a here document feeds the multiple lines of text about to follow, on the spot, as input to a command. We even covered the fine detail that wrapping the terminating marker in single quotes changes whether variable expansion happens at all.

Next came Git, the version-control mechanism itself. There are three areas — the working directory, the staging area, and the repository. Add is a temporary addition to the staging area, and only commit finalizes it into history. The core insight was that a commit’s true nature is a collection of snapshots reusing references to unchanged files, not a diff.

We closed with Nginx. Where a traditional web server assigns one process per connection, Nginx uses an event-driven mechanism, where a small number of worker processes efficiently juggle a huge number of connections. The master process handles config management and monitoring workers, and worker processes handle the actual work. And within a single config file, it carries a dual identity: a face as a web server serving static files, and a face as a reverse proxy forwarding requests to a different server, coexisting at the same time. You built your own config file and confirmed, with your own hands, two different processing paths — a static file, and forwarding to an API — functioning simultaneously on the very same port.

From there, the series moved into two more advanced hands-on labs. The first was building a Linux namespace yourself and experiencing what a “container” really is. Separating a PID namespace with the unshare command made the host’s 87 processes shrink to just 2 visible ones. Those processes never actually disappeared — they simply became invisible to the bash now inside the new namespace. A namespace isn’t a mechanism for duplicating resources — it’s a mechanism for restricting a viewpoint, withholding certain information from a particular process. You also confirmed that separating a mount namespace means any mount operation or file change made inside it never gets reflected on the host side at all. Container technology like Docker and Podman turned out to be nothing more than an orchestration layer, automatically combining these namespaces with cgroups, features the Linux kernel already had all along.

Next came cgroups, the other half paired with namespaces. A namespace only restricts the range of visible information — it places no limit at all on actual CPU or memory consumption. Writing 100M into a cgroup’s memory.max, then adding your own process to that cgroup, let you confirm a process getting forcibly terminated (an OOM Kill) the instant its memory allocation tried to exceed 100MB. The decisive difference from an ordinary out-of-memory condition was that forced termination happened purely because that cgroup itself exceeded its own assigned limit, even with plenty of free memory on the host overall. With cpu.max, too, you confirmed a command that would normally occupy an entire core at 100% getting capped at roughly 5% usage instead. The discovery that the single concept “a container” is actually a combination of two independent mechanisms — “what’s visible” (namespaces) and “how much can be used” (cgroups) — was completed here.

Next came a hands-on digging one layer deeper into that phrase “OOM Kill.” A process that exceeds a memory limit doesn’t exit abnormally on its own — the kernel’s OOM Killer picks a process based on a score called oom_score and forcibly terminates it with SIGKILL. You confirmed, from two records — dmesg and cgroup v2’s memory.events — that when a container suddenly restarts with exit code 137, it wasn’t crashing from a bug, it was just getting “killed” by the OOM Killer. Don’t forget: setting oom_score_adj to -1000 makes a specific process one that’s never killed at all.

Next came zombie processes and the PID 1 problem. When a child process terminates, its exit status keeps sitting in the process table until the parent calls wait(), and that state is a zombie process. A zombie has already finished executing, so running kill -9 against it never removes it. And PID 1 alone is the exception where the kernel never applies default signal handling, keeping SIGTERM ignored unless an explicit handler exists — so when a container’s own application runs as PID 1, docker stop stops working. Don’t forget that lightweight init wrappers like tini and dumb-init take over both of these responsibilities for you.

The final article was a hands-on reproducing the SUID bit’s danger yourself and confirming least-privilege defense via Capabilities. Setting the SUID bit on the find command let an ordinary user obtain a root-privileged shell, via find’s -exec option. This was the result of abusing the mechanism where a SUID-set binary runs with the privilege of the file’s owner, not the user who executed it. The find command itself has no defect — the real problem was the judgment call of casually setting SUID on a binary with the ability to run an arbitrary command. As a defense, you used Linux Capabilities to grant just one specific privilege, cap_net_bind_service, confirming that the needed operation (binding to a privileged port) alone could be achieved, without handing over all of root’s power. The lesson: rather than choosing SUID just because “root privilege is needed,” concretely identify what privilege is genuinely necessary.

The final article wasn’t about learning a new technique, like earlier ones. It was a capstone project: given the setting of a fictional startup, “KoiKoi Dev,” integrating several in-house tools onto a single server, you designed, with your own hands, a single integrated in-house developer platform combining everything you’d learned separately — a reverse proxy via Nginx, traffic restriction via iptables, process isolation via namespaces, least-privilege design via Capabilities, and incident investigation via journalctl. The ability to follow a fixed procedure and the ability to design on your own from requirements are entirely different skills, and even having finished every individual hands-on, you’re not immediately effective in real-world work without the experience of combining them into one coherent infrastructure.

Looking back across all twenty-six articles, a consistent stance emerges. The daemon, the library, the pitfall that a cron job never inherits the interactive shell’s environment at all, the OOM Killer’s real identity behind a forced termination, the real identity of a zombie process that kill -9 can’t remove, inode exhaustion invisible to df -h, the split between kernel space and user space, permissions, SELinux as another layer of access control entirely independent of DAC, the difference between hard links and symbolic links, procfs, iptables, directory structure, how a config file takes effect, journalctl, curl, the concept of a framework, tracking things down with find, redirection and here documents, the true nature of a Git commit, Nginx’s event-driven architecture, a container’s real identity as a viewpoint restricted by namespaces, cgroups’ real identity as the other half, resource limiting, the difference in privilege design between SUID and Capabilities, and the entire in-house developer platform you integrated in the capstone project — every single one of them was really telling the same story: behind whatever’s visibly happening on the surface, who is actually doing the work, and who actually holds control? Not the person typing the command, but reaching all the way through to the program or kernel entity that actually receives it and does the processing — that’s the pattern of thought a top-1% engineer applies almost automatically. And that’s the recap of the Linux/OS Fundamentals series, complete.

Comments

Feel free to leave thoughts, questions, or corrections below (sign in with a GitHub account to comment or react).