Unix Was Right. We Made Linux Too Complicated
Transcript
Machine-transcribed by YouTube. Expect errors in names, commands and version numbers.
That's not Unix. How many times have you read it under a video, in a thread, in an argument about some package? It gets said with the confidence of someone quoting scripture. The problem is that almost nobody has ever opened that scripture. For years, I assumed there was nothing behind it. A formula for ending a discussion, a stamp you press on to whatever software you happen to like or dislike, and nothing more. Then I found out the document exists. written principles numbered with precise names about how you build a program and how you behave toward whoever [music] will use it. Today, we take all of them one by one, none skipped. So the next time someone says that goes against the Unix philosophy, [music] we know exactly what they're talking about and whether they're talking about anything at all. I care because I lived it for nearly a decade.
Everything I loved got labeled that way and I nodded along without the faintest idea what I was agreeing with. So to begin, we must always go to the same year in the same place. Where do we go? Like in a kind of Linux back to the future where instead of the Delorean, there's well come on our terminal. I'm talking about Bell Labs in the 70s where precisely the Unix philosophy originated. It's not just a technical convention, but a true vision of the computational world that has influenced generations of developers and operating systems and subsequently a philosophy that applies to technology itself as a whole. Let me say it, bloated is not Unix. 128 GB of RAM to run Hyperland, a
terminal, and screen [music] recording are not Unix. But let's begin our journey. It's 1969. AT&T's Bell Labs. Ken Thompson and Dennis Richie are working on something that will change the world forever. Before Unix, operating systems were monsters. Complex, monolithic, proprietary, huge beasts that only served specific machines and cost as much as a seaside villa. Think of Multics, a project so ambitious and complicated that it collapsed under its own weight. Thompson and Richie had a brilliant insight. What if we did the opposite? [music] What if instead of building a cathedral, we built a bazaar? small pieces simple that worked together. Unix was born this way from a radical vision, simplicity, [music] modularity, elegance. But it wasn't enough to create an operating system. A philosophy was needed, a way of thinking. And here enters a key figure, Doug Mroy. In 1978, Doug Mroy, the
inventor of Unix pipes, synthesized this philosophy into three fundamental rules that still today, almost 50 years later, are the Bible of software development. Write programs that do one thing and do it well. Not a program that does everything. A program that does one thing. Grep finds patterns. Said transforms text. Cat concatenates files. Period. No frills. No feature creep. No. Oh, but I could also add this functionality. Write programs that work together. This is the real stroke of genius. It's not enough for a program to do one thing well. It must be able to combine with other programs. The output of one becomes the input of another.
Composability, modularity. Unix is Lego, not Plato. Write programs that handle text streams because it is a universal interface. Text, plain text, not proprietary formats, not complex binary structures. Text you can read, modify, parse. Text that in 50 years will still be readable. This is longevity. And with this, ladies and gentlemen, we have the foundations. But let's go deeper. The rule of modularity. Build programs as simple modular parts. [music] Every program is a module. A Lego brick. Complexity emerges from composition, not from internal complication. Let's make a practical example. I want to find how many times the word error appears in a log file. Monolithic approach. Wrong.
Create a giant program that opens the file, reads line by line, searches for the pattern, counts occurrences, prints the result. Unix approach. Right. Three programs. Each does [music] one thing. Together they solve the problem. Tomorrow I want to search for warning. I only change GP. I want to count characters instead of lines. I only change WC. Modularity, the rule of clarity. Clarity is better than cleverness. Rob Pike and Brian Kernahan in their book, The Practice of Programming, say it clearly. Clever code is the enemy. Code must be clear, readable, understandable. There's this tendency, especially among young programmers, to want to be clever, to write incomprehensible oneliners, to use obscure tricks, to demonstrate how intelligent you are. Unix says, "Stop.
Write code your grandmother would understand." Okay, maybe not your grandmother, but at least you in 6 months when you have to debug [music] it at 3:00 a.m. Clarity is not a luxury, it's a necessity. The rule of composition. Design programs to be connected with other programs. This is the beating heart of Unix. Pipes, that little vertical bar that is literally the physical representation of this principle. This is poetry. Four programs that know nothing about each other, but together do something powerful. They find the Firefox process and kill it. The pipe is the physical incarnation of composition. The output of one program becomes the input of the next. Data streams flowing through a chain of transformations. It's Unix. It's beautiful. The rule of separation.
Separate policy from mechanism. This is subtle but fundamental. Mechanism answers how it works. Policy answers what it does. Example, a text editor. The mechanism is how it saves files to disk. The policy is which files to save and when. [music] If you separate mechanism and policy, you can change one without touching the other. You can change the save policy autosave every 5 minutes instead of manual without rewriting the code that writes to disk. Flexibility without chaos. This is the power of separation. The rule of simplicity, keep it simple, stupid, [music] kiss. But careful, simplicity is not simp. It's not [music] let's do everything carelessly. It's let's eliminate everything superfluous.
Antoine de Santex, the author of the little prince said, perfection is achieved not when there is nothing more to add, but when there is nothing left to take [music] away. This is Unix. Remove, remove, remove until only the essential remains. Every line of code is a liability. The less code you have, the fewer bugs you'll have, less code to maintain, less complexity. [music] Simplicity is the art of saying no. The rule of silence. When a program has nothing surprising to say, it should say nothing. Unix programs are silent. [music] They do their job and shut up. Only errors deserve attention. No output. It went well. Silence is consent. If you compare this with some modern programs and their longs output, well, no, stop. I'm cursing just reading this stuff. The rule of repair. When you must fail, fail noisily and as soon as possible. The opposite of silence is failure. When something goes wrong, scream clearly, explicitly, immediately.
Don't hide errors. Not, "Oh, yes, there was a problem, but whatever. Let's move on." No. Stop [music] everything. Signal the error. Terminate with an appropriate exit code. Zero equals success. nonzero specific error. Fail fast, fail loud,
fail clear. The rule of economy, programmer time is expensive. Conserve it in preference to machine time. Programmer time is worth more than machine time. Period. Don't reinvent the wheel. Use existing tools. Build on what's already there. If there's a command that does what you need, [music] use it. Don't rewrite it because I want to learn or I want to do it better. There's time to learn. There's time to optimize. [music] But first, does it work? Then use what's there. The rule of generation. Avoid hand hacking. Write programs to write programs when you can. Meta programming, code generators, pre-processors, make files, scripts that generate scripts. If you have to do something repetitive, automate it. Write a program that does it for you. Not only do you save time, but you reduce errors.
Example, [music] instead of manually writing 100 similar configuration files, write a template and a generator. The rule of representation, fold knowledge into data so program logic can be stupid and robust. This is subtle but extremely powerful. Fred Brooks in the mythical man month says, "Show me your flowcharts and conceal your tables and I shall continue to be mystified. Show me your tables and I won't usually need your flowcharts." Smart data structures, dumb code, dumb data structures, smart code. Instead of having a gigantic switch case with 100 conditions, put that logic in a table or a configuration file and do a simple lookup. The code becomes trivial. The logic is in the data. Data is easier to modify, test, validate.
Eric S. Raymond in his the art of Unix programming talks about taste in software design. [music] It's not just functionality, it's elegance, its beauty. There's an aesthetic in Unix, a harmony. When you see a good Unix command, you feel it's [music] right, that it's beautiful. It's not just that it works, it's that it works with grace. This is reflected in the programs in the same distributions that adhere most faithfully to this philosophy. They have a particular aura. They are unique yet simple, powerful and not complicated. demanding but not hermetic. The Unix philosophy shares aspects with Japanese minimalism, the concept of wabishabi, the appreciation of simplicity, functional imperfection, the essential. [music] Every Unix command is like a haiku.
Maximum meaning, minimum words. Three characters, three flags, absolute power. Please don't execute it. It reminds me a lot of Italian hermeticism. Unix is like milumino demenso, the solidification of a moment in which awareness is reached. An absolutism that requires nothing else, something that is very close to the truth. In 1989, Richard Gabriel wrote an essay that would become legendary in the computer science world titled [music] worse is better. It's a text that seeks to explain why Unix and C dominated the software world [music] despite the existence of technically superior systems. Gabriel contrasts two completely different software design philosophies. On one side is what he calls the right thing. [music] The MIT and Stanford approach. This philosophy says that correctness is sacred. [music] It comes before everything else. A system must be complete, must cover all possible cases, must be internally consistent in every part. The idea is that you must aim for theoretical perfection [music] even if this requires more time and more complexity.
It's the approach of academics, perfectionists, those who think soft should be a mathematically perfect work of art. On the other side is worse is better. The New Jersey approach, the Unix approach. This philosophy completely flips the priorities. Simplicity of implementation comes first. It doesn't matter if the system isn't perfect. It doesn't matter if there are edge cases you don't handle. What matters is that it's simple to implement, simple to understand, [music] simple to port to other platforms. Pragmatism beats idealism.
Good enough wins over perfect. Gabriel gives a concrete example. Imagine a system function that is called while it's handling critical data. An error occurs. The right thing approach would say the operating system must save state, handle the error completely and [music] correctly, and then resume. This is complex, requires a lot of code, but is theoretically perfect. The worse is better approach says instead, if an error occurs at that moment, simply return an error code and let the programmer handle it. It's simpler, less perfect, but it works [music] and is very easy to implement. Gabriel's provocative thesis is that [music] worse is better always wins. Unix beat technically superior systems like Lisp machines precisely because it was simple, [music] could be ported anywhere, ran even on modest hardware. C beat more elegant languages like Lisp for the same reason. Simplicity allowed it to spread rapidly to be adopted to create a critical mass of users and developers. It's an almost Darwinian philosophy. The strongest or most perfect [music] doesn't win. The one that adapts better wins. That reproduces faster. A good enough system running on a thousand machines [music] beats a perfect system running only on 10 very expensive machines.
This philosophy also explains why Linux succeeded. It wasn't technically perfect. Tannon criticized it fiercely saying its monolithic design was obsolete. [music] But Linux was simple, pragmatic, it worked and people could modify and improve it. The theoretical perfection of the Minu micro kernel lost against the good enough [music] pragmatism of Linux. Gabriel himself admits this philosophy has a dark side. It means accepting compromises. It means sometimes the software doesn't do exactly what it should do. But his thesis is that this is an acceptable price if it allows the software to spread, evolve, improve iteratively through real use in the real world. It's a profoundly anti-academic philosophy that goes against the instinct of every perfectionist engineer. But it's also incredibly honest in recognizing how the software world really works. Standards wars are won by simple and widespread systems, not perfect and niche ones.
And how does all this relate to our ecosystem today? [music] Well, at this point, we must do something uncomfortable. We must stop looking at Unix as a religion and start looking at it for what it really is. a compass, a guiding star, not a divine law carved in stone. Because if we look at today's world with the eyes of 1970, we risk understanding nothing. [music] Modern systems are complex, not philosophically, physically. A modern laptop is not a terminal attached to a mainframe. It's a machine that constantly changes state. [music] You connect a monitor, disconnect a monitor. You move from home Wi-Fi to the airport. You connect Bluetooth headphones while watching a video. You close the lid, reopen [music] it, suspend, resume. All this must work without you having to think about it. And this is the key point. Complexity wasn't born from malice. It was born because users wanted things to work immediately, [music] always. And this is where the great accused enter the scene. System D, complete desktop environments, pulse audio first and pipe wire later, network manager, snap, flatpack. They weren't born to betray Unix. They were born to coordinate chaos. The problem isn't that they exist. The problem is how they exist. Unix teaches you one thing very clearly. If you do one [music] thing, do it well. If you do multiple things, make them separable. If you communicate, [music] do it in a readable way. And this is where something broke. When a system becomes a monolith that does everything, [music] when every component depends on another, when you can no longer choose, remove, understand, then you're no longer managing complexity. you're hiding it under the rug. System D is the perfect example. Not because it sucks or because it's evil, but because it represents an opposite philosophy. Total integration, tight coupling, binary logging, everything goes [music] through there. Does it work? Yes. Is it convenient? Often yes. Is it Unix? No.
And the same discourse applies to modern desktops. Gnome and KDE aren't bad. They're ecosystems. And an ecosystem by definition is not composable. Unix instead is precisely this. You choose the pieces, you combine them, you change them, you replace them. The point isn't to go back to 1995. The point is to ask, was it really necessary to completely lose modularity to have a modern desktop? [music] The honest answer is no. We could have managed complexity more intelligently, with more separation, with more transparency, with fewer dammons [music] that do everything. Instead, we often chose the easy road. Add a layer, then another, then another. RAM is cheap anyway. The CPU is fast anyway. And today we find ourselves with systems that struggle, that consume resources disproportionately, that become fragile precisely because they're too integrated. Desktops that hiccup under the weight of libraries upon libraries, programs bloated with useless functions, RAM that increases hyperbolically.
And this is where the Unix philosophy becomes useful again, not as dogma, but as a mental filter. Unix doesn't tell you to write everything in C. [music] Unix doesn't tell you not to use a modern desktop. Unix asks you only one thing, honesty in design. Always ask yourself, am I doing one thing or 100? Can I remove a piece without everything collapsing? Do I understand what's happening underneath? If the answer is no, maybe it's not a technical problem, it's a philosophy problem. And careful, [music] extreme purism is also a trap. Thinking you can live today only with minimalist tools without compromises is unrealistic. [music] It's ideology. But the extreme opposite is too. Accepting any complexity just because that's how it is now. The truth is in the middle and it's an uncomfortable truth. We could have done better. We didn't need system D. It wasn't the only solution. We didn't need to completely give up the Unix spirit to face the modern world. We simply stopped trying. We chose the path of ease, of total integration, of it works anyway.
[music] And maybe that's why every now and then when you open a terminal, write a well-made pipeline, see three programs collaborating in silence, and solving a problem elegantly, you feel that thing there is still right. It's not nostalgia. It's good design. And that's what Unix comes down to. Small parts, honestly made, put together into something big. Clarity over cleverness. one job done properly instead of a hundred done halfway. None of this died. It got covered over by abstraction stacked on abstraction by [music] dependency trees nobody reads. By demons that decided they should handle everything, but it's still down there. Every program that does one job and does it right digs a little of it back out. Every time someone says no to one more feature, it breathes again.
This isn't a call to purism. Nobody needs to refuse every new idea in the name of keeping the faith. But we also don't have to shrug and accept that software must be opaque, tangled, impossible to take apart. It doesn't. It never had to be, and it doesn't have to stay that way. See you in the next video, and may the Unix philosophy be with [music] you.