My Login Shell in Assembly

April 9, 2026
Detailed image of a snail shell showcasing intricate patterns and textures on a rock.
Photo by David Römischen on Pexels

The genesis

Three shells. Three languages. One obsessive through-line. The author started with rsh, a hand-crafted Ruby shell — roughly 4,048 lines and a comfortable feature set, but slow to start (it has been reported that startup was around 300 ms). A Rust rewrite, rush, trimmed that to ~26 ms and 4,280 lines, but still relied on libc and a memory allocator as part of the runtime. Then, driven by curiosity and a dash of nostalgia, the project leapt to bare: an interactive login shell written entirely in x86_64 Linux assembly. It has been reported that bare became the developer’s daily shell after "four evenings" of coding with help from an AI assistant.

What it is

bare is a single NASM assembly file — bare.asm — implementing a surprisingly full-featured shell: dynamic prompts with git indicators, job control, tab completion, history search, syntax highlighting while you type, plugins, even AI hooks like :ask and :suggest. The binary is tiny and fast; it has been reported that the compiled executable is about 126 KB and starts in roughly 8 microseconds. Everything here is done with raw syscalls — fork, execve, pipe, dup2, open/read/write, ioctl, getdents64 — no libc, no dynamic linking, no heap. Tiny, brutal, and oddly elegant.

The nitty-gritty

The author reimplemented things shells usually borrow from libraries: terminal raw mode via ioctl(TCSETS), line editing with ANSI escapes, directory scanning with getdents64, reading .git/HEAD to find branches, and comparing mtimes to detect git dirty state. The BSS section supplies statically allocated buffers; the kernel's zeroing of BSS replaces malloc and brk. It has been reported that the shell measures faster than common counterparts — allegedly 3.4× faster than bash on per-invocation CPU time and 27× faster than the Rust version — and is orders of magnitude smaller than many modern binaries.

Why it matters

Is this practical for everyone? No. Is it a remarkable engineering exercise? Absolutely. The emotional core of the story is learning — every segfault and terminal hang taught the author about process groups, termios, signals and the plumbing behind cute shell conveniences. It's also a micro-trend signpost: minimalism, performance fetishism, and hands-on systems work all wrapped up with a modern twist (AI-assisted coding). For folks who like to live dangerously close to the kernel — and to learn from the scars — bare is a fascinating, readable proof that you can take almost everything a shell does and implement it with nothing but syscall opcodes and stubborn attention to detail.

Sources: isene.org, Lobsters