Let's start with a number: 45. That's how many bytes it takes to craft a Linux executable that does nothing but exit cleanly. Forty-five bytes. That's smaller than most people's passwords. And yet, this tiny chunk of machine code—born from the fever dreams of assembly nerds—is a perfect testament to the art of minimalism in programming.
The piece in question is Brian Raiter's "Teensy Executable Revisited," a write-up that's been floating around Hacker News and sending a fresh wave of geeks down a rabbit hole of ELF headers, alignment constraints, and sheer audacity. The original "Teensy" article from the late '90s showed how to get a Linux binary down to 45 bytes. This revisit? It explains the journey—and the compromises—that got it there.
Why 45 Bytes Matters (and Why It Doesn't)
Let's get one thing straight: nobody needs a 45-byte executable. Not today, not in the era of gigabyte containers and bloated Electron apps. But that's exactly the point. This isn't about utility. It's about curiosity. It's about saying, "How small can we make this before it breaks?" And then pushing that boundary just to see what happens.
Raiter's journey starts with the ELF format—the standard binary format on Linux. A minimal ELF executable needs a header, a program header, and some actual code. The header alone is 52 bytes if you do it the usual way. So how do you carve that down to 45? You cheat. You overlap structures, you skip fields, you rely on undocumented behaviors of the kernel's loader.
Case in point: Raiter discovered that if you point the program header's offset to somewhere inside the ELF header itself, the kernel will misinterpret a chunk of the header as code. That's not a bug—it's a feature. The result? A binary that's simultaneously a valid header and a valid program. It's poetry, if poetry were written in hexadecimal.
"The most interesting part is finding out exactly what the kernel will accept, and what it won't." — Brian Raiter, from the article
The Dance of the Bugs
Of course, playing with fire means you're going to get burned. The original 45-byte executable relied on a quirk in older Linux kernels: they would happily load an ELF with a program header offset of 0x04. Newer kernels? Not so much. They got stricter, and the tiny binary stopped working.
That's where the "Revisited" part comes in. Raiter documents how he adapted. He found that by setting the program header offset to a specific value (like 0x00), and carefully arranging bytes, he could get it working again. The result: a 46-byte version that's been tested on kernels up to 5.x. One byte lost to progress. It's almost poetic.
But here's the kicker: even the 46-byte version is fragile. It relies on the kernel not caring about certain reserved fields, or on specific behaviors of the ELF loader. It's a house of cards, but a beautiful one.
What This Teaches Us
You could argue this is pointless technical masturbation. And you'd be partly right. But there's a deeper lesson here: understanding the bare metal. When you strip away layers of abstraction—compilers, linkers, cargo-cult programming—and stare at raw bytes, you start to grok how a computer actually works.
Modern programming is all about abstraction. We write in Python, Rust, or JavaScript, and the compiler handles the dirty work. We rarely think about page alignment, segment mapping, or the precise layout of an ELF header. But someone, somewhere, has to. And when they share their discoveries, it makes everyone smarter.
Also, it's just fun. There's a childlike glee in making something so small, so weird, and so functional. It's the hacker equivalent of a magic trick.
The Legacy Lives On
Raiter's work isn't just a historical curiosity. It's directly inspired other minimalists. The legendary "A Whirlwind Tutorial on Creating Really Teensy ELF Executables for Linux" is still referenced in assembly forums. There's even a GitHub repo that tracks the smallest possible static executables for different architectures.
And it's not just about size. It's about elegance. When you look at that 45-byte blob, you see a perfect union of data and code. The ELF header, the program header, and the code all overlap in a way that's both clever and fragile. It's a Rube Goldberg machine made of bytes.
So next time you're frustrated by a bloated node_modules folder or a 200MB video game patch, remember the teensy executable. Somewhere out there, a hacker is counting bytes, and they're doing it for the sheer joy of it. That's something worth revisiting.



