Cover art for What Bash Actually Does Between You and the Kernel
Episode 6765 custom

What Bash Actually Does Between You and the Kernel

When you run a command in Bash, an strace reveals just three system calls: clone, execve, and wait4.

30:08 Transcript

0:00
0:00
Episode Details
Episode ID
MWP-6969
Published
Duration
30:08
Audio
Direct link
Pipeline
V5.36
TTS Engine
omnivoice
Script Writing Agent
GLM-5.3

AI-Generated Content: This podcast is created using AI personas. Please verify any important information independently.

The prompt

The prompt that started this episode, as sent in (production notes for the hosts removed).

I've used Linux for years and type into Bash every day, so this may sound like an elementary question, but I've never really understood what Bash actually is. I think of it as an abstraction over the operating system, but how deep does that abstraction go? When I type a command and press Enter, what does Bash itself do, and where does its job end and the kernel's begin? How does a shell actually talk to the OS: is it just another ordinary program asking the kernel for things, and what makes it a "shell" rather than any other process? I'd like to come away with a clear mental model of where Bash sits between me and the kernel.

Bash powers modern computing infrastructure, yet its actual architecture is far more modest than many realize. Rather than serving as an intrinsic part of the operating system or the kernel, Bash is simply an ordinary user program that describes itself as a macro processor that executes commands. Between a keystroke and kernel execution, Bash expands text, resolves command names through an internal search order, and uses the classic Unix fork-exec pattern to run external programs. By tracing system calls, the execution model reveals itself: the parent shell duplicates itself, hands over an environment array, uses execve to replace the child process, and waits for an exit status while remaining completely parked.

Sources

What the research for this episode read before the script was written. Primary sources first.

  1. GNU Bash Reference Manual, Edition 5.3 (Bash 5.3), last updated 2025-05-18 primary retrieved 2026-11-26
  2. GNU Bash Reference Manual §3.1.1 Shell Operation primary retrieved 2026-11-26
  3. GNU Bash Reference Manual §3.7.2 Command Search and Execution primary retrieved 2026-11-26
  4. `bash(1)` man page, man7.org (copyright 1989 primary 2025 FSF), retrieved 2026-11-26
  5. `fork(2)` man page, man7.org primary retrieved 2026-11-26
  6. `execve(2)` man page, man7.org primary retrieved 2026-11-26
  7. `readline(3)` man page, man7.org primary retrieved 2026-11-26
  8. Wikipedia, Bash (Unix shell), last edited 2026-11-17 (Unix_shell), retrieved 2026-11-26
  9. Wikipedia, Unix shell, last edited 2026-07-27 retrieved 2026-11-26
  10. Wikipedia, Bourne shell, last edited 2026-11-25 retrieved 2026-11-26
  11. Wikipedia, Shell script, last edited 2026-11-25 retrieved 2026-11-26
  12. The Command Line as the System Interface, enterprisecampus.net OS fundamentals course retrieved 2026-11-26
  13. fork(), exec(), and Process Creation, Project Lighthouse OS fundamentals retrieved 2026-11-26
  14. Unix StackExchange, How to understand the output of tracing running an external command in bash? retrieved 2026-11-26
  15. Unix StackExchange, Why does 'ls' require a separate process for executing? (answer by Chris Down) retrieved 2026-11-26
  16. StackOverflow, what are shell built-in commands in linux? (answer by Roman Cheplyaka) retrieved 2026-11-26
  17. StackOverflow, Do exec() calls fork for each command if passed a shell script? (answer by Barmar) retrieved 2026-11-26
  18. StackOverflow, System calls, shell commands and programs retrieved 2026-11-26
  19. BashGuide, Internal Commands and Builtins retrieved 2026-11-26
  20. Georgia Tech CS3210, Shells and Interfaces lecture slides retrieved 2026-11-26
  21. MIT 6.828, Lecture 4: Shell retrieved 2026-11-26
  22. xv6: a simple, Unix-like teaching operating system, Ch. 1 Operating system interfaces retrieved 2026-11-26
  23. Components of a Modern Operating System, The Coded Message retrieved 2026-11-26
  24. Peter Martin, Linux concept: POSIX retrieved 2026-11-26

Mentions

  • Bourne shell Stephen Bourne's original sh Bash replaced
  • execve System call replacing a process image
  • fish Alternative shell sharing the same syscall story
  • glibc GNU C library, standard on most distros
  • GNU Bash The shell itself, GNU's Bourne-Again SHell
  • GNU Readline Line-editing library handling interactive input
  • POSIX Standard Bash conforms to for compatibility
  • strace Linux syscall tracing tool
  • xv6 MIT teaching operating system book
  • zsh Alternative shell with same fork/exec model

Downloads

Episode Audio

Download the full episode as an MP3 file

Download MP3
Transcript (TXT)

Plain text transcript file

Episode Book (PDF)

The episode's record — date, duration, models, sources — with the full transcript

#6765: What Bash Actually Does Between You and the Kernel

Corn
Daniel types into Bash every single day, and this week he admitted something he seemed almost embarrassed about: after all these years, he can't actually say what Bash is. He thinks of it as "an abstraction over the operating system," his phrase, and he wants to know how deep that abstraction goes. What does Bash itself do between his keystroke and the kernel's work, where does its job end, and what makes a shell a shell rather than just another process?
Herman
And the answer is deflationary in the best way. Bash is an ordinary program. Not part of the operating system, not part of the kernel, no special privileges. It's an ELF executable sitting in slash bin, exactly as ordinary as the ls command it launches.
Corn
Which is either disappointing or the most interesting thing he'll hear this week, depending on taste.
Herman
His taste is fine. The Bash manual describes itself with the most modest self-description I've ever read for a piece of software people live inside: "At its base, a shell is simply a macro processor that executes commands." A macro processor. Something that expands text into bigger text and then runs it. That's the whole résumé.
Corn
That's the line on the business card of the thing running half the world's servers.
Herman
And I mean that literally — deploy scripts, cron jobs, container entrypoints, the little glue that holds the internet's plumbing together. All of it kicked off by a program that describes itself the way a janitor describes himself as "someone who moves things from one place to another." Technically complete and wildly understated.
Corn
The provenance is worth a minute, because it explains the shape. Nineteen eighty-nine, Brian Fox, writing it for the GNU Project as a free replacement for the Bourne shell — Bourne-Again SHell, the pun is right there in the name. It had to be a drop-in for Stephen Bourne's original, so the design constraint wasn't elegance, it was compatibility. It's POSIX-conformant, it's now the default login shell on most Linux distributions, and the current reference manual is Edition 5.3, updated May of last year. It's a living document.
Herman
And the compatibility constraint matters for the whole episode, because it means almost nothing in Bash was chosen fresh. The syntax quirks, the expansion rules, the way test brackets work — all of it had to keep thirty-five-year-old scripts running. When something in Bash seems weird, the answer is usually "the Bourne shell did it that way in 1977 and a script somewhere still depends on it."
Corn
One clarification before we go on, because Daniel's framing deserves it. "An abstraction over the operating system" — that's his phrase, and it's a reasonable one, but you won't find it in any manual. No canonical source says that. The documented framings are much humbler: the macro-processor line, and the operating-systems-textbook line that the shell is just a user program exercising the system call interface.
Herman
Which is actually the more useful framing, because it makes you ask the right question. If the abstraction is thinner than it feels — and it is — where does the thickness you're feeling come from? That's the episode.
Corn
So let's start with the deflation. What Bash actually is, in its own words.
Herman
Here's the clean version. You type text. Bash reads it, expands it, decides whether the work happens inside itself or in another program, and if it's another program, it hands the kernel three things: a path, an argument list, and an environment. Then it sits and waits. That's the whole job.
Corn
Three things and a nap. Finally a job description I qualify for.
Herman
The manual actually enumerates this. Section 3.1.1, Shell Operation — seven steps. Reads its input from a file, from a string, or from your terminal. Breaks the input into words and operators, obeying the quoting rules. Parses the tokens into simple and compound commands. Performs the shell expansions. Performs any redirections, and removes the redirection operators from the argument list. Executes the command. And then, optionally, waits for the command to complete and collects its exit status.
Corn
People remember the first six steps and forget the seventh. The waiting is part of the job, not a break between jobs.
Herman
That seventh step is where the shell becomes a supervisor. But hold on to that — let's walk the steps, because step six, "executes the command," is where four words are carrying an entire architecture.
Corn
Go on then. What does execute actually mean?
Herman
The manual's own drill-down is in section 3.7.2, Command Search and Execution. If the command name has no slash in it, Bash checks shell functions first. If there's a function with that name, the function is invoked, full stop — it never leaves Bash. Then it checks the builtins. Then, and only then, it walks the directories in your PATH looking for an executable by that name. And it cheats efficiently here: Bash keeps a hash table remembering the full pathnames of executables it has already found, so it doesn't re-search the PATH for every ls. If the search fails, it tries a function called command_not_found_handle if you've defined one, and if not, it prints an error and returns exit status 127.
Corn
A hundred and twenty-seven. I've always enjoyed that number — the system's way of saying "I looked everywhere, it's not me, you spelled it wrong."
Herman
And the order of that search is itself a lesson. Functions before builtins, builtins before disk — which means you can shadow a real program by defining a function with the same name, and some people do it deliberately, wrapping ls to always add color or wrapping rm to always ask first. The shell's own dispatch list is a feature.
Corn
And the hash table — that's the thing that bites you, right? You install a new binary and Bash keeps launching the old location?
Herman
You install a new binary somewhere earlier in your PATH, and Bash keeps using the stale remembered path until you run hash -r. People hit this constantly and blame the PATH, when it's the shell's own little cache being too good at its job. It's a perfect miniature of the whole episode: a convenience layer, invisible, occasionally surprising, and trivially cleared once you know it exists.
Corn
And if the search succeeds, what then?
Herman
The manual says the shell "executes the named program in a separate execution environment." That is the load-bearing sentence. Separate execution environment is doing the work of three system calls, and the manual never names them, because Bash documents behaviour and the kernel documents mechanism. Two different books for one boundary.
Corn
So name them. The three calls.
Herman
Fork, execve, wait. Fork duplicates the calling process — the man page says the child is an exact duplicate of the parent, except it has its own PID, reset CPU-time counters, an empty pending-signal set, and a short list of other differences. Then execve replaces the program running in that child with a brand-new program: new stack, new heap, new data segments, everything from the old program overwritten. And the man page has my favourite sentence in all of systems documentation: "execve does not return on success." Not "returns zero." Doesn't return. There is no coming back, because the thing that would return no longer exists.
Corn
The syscall equivalent of "I'm moving out and not leaving a forwarding address."
Herman
Then the parent, meanwhile, has called wait4, and it just sits there. Parked. The kernel gives it the child's exit status when the child dies, and that status is what Bash turns into dollar-question. The whole afterlife of an error code is one kernel message to a waiting parent.
Corn
Herman, before you get to the trace — there's a detail I want to check with you, because it changed how I think about this. The child inherits copies of the parent's open file descriptors.
Herman
Yes — and each descriptor in the child refers to the same open file description as the parent's. Same file offset, same status flags. The fork is the moment your redirection is settled.
Corn
That's the part nobody connects. Redirection isn't a feature Bash performs on the child's behalf during execution — Bash opens the file itself, before the fork, and the child inherits the already-open descriptor. Redirection works because of a side effect of process duplication.
Herman
And you can watch this go wrong in a very specific, very human way. If Bash couldn't do the redirection before the fork — say the file you're redirecting into doesn't exist and can't be created — the error is Bash's error, printed by the shell itself, and the command never runs at all. No fork. People have seen "permission denied" from a redirection and assumed the command failed, when the command was never born.
Corn
The shell refuses at the door, before there's a child to refuse.
Herman
Right. And that's not an accident of the design. Well — the fork/exec split itself is sort of an accident, it's a nineteen-seventies PDP-7 inheritance, duplicating an entire process just to throw the duplicate away when execve loads the new program. It's wasteful and strange and it's also why everything else works. The constraint falls out of the mechanism rather than the mechanism being designed to meet the constraint.
Corn
Sloths approve of designs nobody planned that outlive everything planned.
Herman
I know you do. One more inheritance detail, because Daniel asked how a shell "talks to the OS." The environment. Your exported variables. Bash builds an array of key-equals-value strings — that's the envp argument — and hands it to the kernel at execve time. That array is the entire mechanism behind export. There's no ambient OS-level environment store; there's a string array a parent hands to a child, once, at the moment of replacement.
Corn
Environments flow downhill, one exec at a time, and never back up.
Herman
Same principle, viewed from the other side of the boundary. The kernel also does something most people credit to Bash: when you run a script, the kernel reads the hash-bang line. Not Bash. execve itself takes a path that must be a binary or a script starting with hash-exclamation-mark-interpreter, and the kernel loads the interpreter. Bash hands over a path; the kernel decides what runs.
Corn
So the trace. You said there's a way to see this with the naked eye.
Herman
strace, following child processes, filtering for just the three calls. Trace a Bash running the ls command on slash tmp and you see exactly three lines: clone — the modern fork, glibc's fork wrapper has used clone under the hood since glibc 2.3.3 — then the child's execve of slash bin slash ls, then the parent's wait4. Three lines. The entire mystery of "what happens when I press Enter," answered in a three-line receipt.
Corn
Every religion promises less with more words.
Herman
There's a real trace floating around of someone tracing the date command, and it's even better, because you can watch the handoff happen inside one screen of text. The parent clones a child, then the parent's line reads wait4, unfinished — it's blocked. The child's line reads execve, slash bin slash date, with sixty-six environment variables in the array. Then exit group, zero, exited with zero — and the parent's wait4 line resumes with the status.
Corn
Sixty-six variables. The environment is heavier than the command.
Herman
Almost always is. Your prompt, your PATH, your locale, everything you've exported — all of it crosses the boundary as text, every single time, even for a program that prints the date.
Corn
Wait. Say that number again — the parent is literally parked in wait4?
Herman
Not metaphorically parked. Blocked in a system call, doing nothing, until the kernel tells it the child is gone. That's the picture Daniel should keep: Bash isn't running your command in any sense. Bash is a parent standing outside a door.
Corn
And here's the follow-up that always occurs to me at this point: how does anything ever run in parallel, then? If the shell blocks on every command, how do I get a prompt back while a long job churns in the background?
Herman
Because the blocking is a choice per command, not a law. Synchronous commands get the wait; asynchronous ones — the ones you background with an ampersand — don't. Bash forks the child, skips the wait4, and goes straight back to reading your next line. The child runs on the kernel's schedule, orphaned to init if the shell exits before it does. The shell's whole job-control apparatus — jobs, fg, bg, the notifications that a background process finished — is Bash keeping its own ledger of children it chose not to wait for yet, and settling up later.
Corn
So the next question has to be cd. Because if every external command lives on the far side of a fork, and the parent's state is untouchable...
Herman
Then cd cannot be external. That's the manual's own list: cd, break, continue, and exec — they cannot be implemented outside the shell, because they directly manipulate the shell itself. A forked cd would change the working directory in the child, the child would exit, and your shell would be exactly where it always was. Same reason if and while are built in — control flow is the shell deciding, not a program running.
Corn
And you can prove this to yourself in ten seconds, can't you? Type the path to slash bin slash cd directly.
Herman
If your distribution ships one — some do, as a stub — you get the perfect demonstration. The command runs, it exits successfully, and you're in the same directory you started in. The child changed its own working directory and died there. It's almost performance art: a program that succeeds completely and accomplishes nothing you wanted.
Corn
And exec is the strange one.
Herman
The exception that proves the rule. Every other command gets a fork; exec doesn't. It calls execve on itself — replaces the current process instead of duplicating it first. Your shell deliberately doesn't come back. It's the one builtin that's a one-way door, which is the exact opposite of what a shell is for, which is why you use it maybe twice a decade.
Corn
Whereas echo is a builtin for the most mundane reason in computing.
Herman
Performance. echo and printf could be external — and there is a slash bin slash echo — but avoiding a fork and an execve for something that prints one line is worth it. The manual's word for the others is "inconvenient." Some builtins exist because they're impossible, some because they're cheaper. You can check which is which with the type command — type cd says builtin, type echo says builtin, type ls gives you the path on disk.
Corn
And it's the same test that reveals the layer I find most disorienting: the thing you're typing into, before Bash even parses it, isn't Bash.
Herman
Interactive line editing is the GNU readline library. A separate library Bash links against. The bash man page documents a noediting flag that tells Bash not to use it — and readline has its own configuration file, its own keybindings, its own whole existence. Bash hands readline the prompt string; readline returns a line of text, newline stripped, malloc'd, caller frees it. That's the interface between them.
Corn
So when your up-arrow recalls a command, Bash hasn't done anything yet. The sentence hasn't even reached the building.
Herman
Even the question "am I interactive?" is answered before parsing, and it's a syscall test: the manual defines an interactive shell as one whose standard input and standard error are both connected to terminals, as determined by isatty. Bash asks the kernel whether a file descriptor is a terminal. That's how it decides whether to be chatty with you.
Corn
Which explains something that confuses everyone the first time: why a script that works perfectly when you type it goes quiet when you run it. Same Bash, same commands, but isatty comes back false and Bash stops printing prompts, stops echoing, becomes a different personality. The shell has moods, and the kernel sets them.
Herman
Which brings me to the thing I want on record before we go further, because people sell this wrong. The claim you sometimes hear — that the shell "is Linux," or that it's part of the kernel — an operating systems text I like puts it bluntly: it isn't. Slash bin slash bash is an ordinary ELF executable running in user mode, able to do only what any other program can do. System calls.
Larry
Folks, are you tired of your shell being nothing but an ordinary user mode binary with no more privilege than a paperweight? Then you need ShellShield Pro, the only macro processor that executes commands and also makes coffee, walks your dog, and refinances your mortgage. And here is the incredible part, the price is dropping right now while I talk, we started at four thousand nine hundred and ninety nine dollars, now it is three thousand two hundred, now two thousand one hundred, and for the next forty seconds it is just nine hundred and ninety nine dollars, and I will throw in a free kernel, a spare fork, and a commemorative exit status one hundred and twenty seven.
Herman
Hang on, "no more privilege than a paperweight" — that's not right, paperweights don't make system calls at all, the privilege framing is...
Corn
Herman. Let it go. It's a free kernel, you can't argue with a free kernel.
Herman
A spare fork, though. You'd want the free kernel to at least...
Corn
Moving on. You were saying — ordinary user mode binary.
Herman
Ordinary. And the teaching texts make a point of it as a design lesson, not a complaint. MIT's xv6 book — the little teaching operating system — uses the shell's ordinariness as the illustration of the power of the system call interface: many processes, one kernel, and the kernel is just a special program providing services to running programs. The shell could be replaced without the kernel noticing or caring.
Corn
Georgia Tech's slides say the same thing in a table, don't they.
Herman
"A user program, not part of the kernel." "Easily replaceable" — their word — "bash, zsh, csh." Three columns in a lecture slide and the entire mystique is gone.
Corn
So that's the mechanism. Now the interesting part — if Bash is this ordinary, why does the abstraction feel thick enough that Daniel, who is not a beginner, thought to call it an abstraction over the operating system?
Herman
Because the thickness is real. It's just not where he assumed it was. The thickness is all syntax and convenience: expansion, pipes, redirection, job control, the working directory context, control flow. That's the feature set that makes a shell a shell — the Unix shell article lists it: variable definition and substitution, command substitution, filename wildcarding, stream piping, control flow structures, here documents. All of that is genuine machinery, and you feel it every day. None of it is privilege.
Corn
The magic you're feeling is a text processor.
Herman
A very good text processor. The manual's two-hats framing: a Unix shell is both a command interpreter and a programming language, and the programming language lets you combine the utilities — your script files get the same status as system commands in slash bin. That's the second hat. The first hat is the reading and dispatching. The perceived depth comes from the fact that the two hats are welded together, not from anything underneath them.
Corn
And the welding is the trick, isn't it. A wildcard like star-dot-txt looks like it talks to the filesystem directly, like the shell has some special channel to the file list.
Herman
It doesn't. The shell expands the glob itself, before the fork — it reads the directory, matches the names, and hands the child a longer argv. The child never knows a wildcard existed; it just receives a list of filenames as arguments. Every piece of shell "power" you can name dissolves like that when you ask where it happens. Pipes? The shell creates the pipe file descriptors and wires them across two forks. Substitution? The shell forks, captures the child's output as text, and pastes it into the line before running anything. It's a text processor all the way down, doing everything in its own process, with ordinary calls.
Corn
Which reframes Daniel's question, doesn't it. He asked what makes a shell a "shell" rather than any other process, and the answer isn't a property of the process at all.
Herman
Right — "shell" is a role, not a species. Nothing in the kernel marks a process as a shell. There's no flag, no special status. Any program could do what Bash does: read text, expand it, fork, exec, wait, manage a session. The kernel wouldn't know the difference and wouldn't care. Your default shell is just a per-user field in the passwd file — or a directory service like LDAP if you're at a big shop. It's an appointment, not a birthright.
Corn
So what does the role actually consist of? If I wanted to write a shell tonight — a bad one, but mine — what's the job description?
Herman
That's a good test, actually. What would you say it is? Before I answer.
Corn
Read a line. Expand the text. If the word is mine, do it. If not, fork, hand the kernel a path, argv and envp, wait, report the number.
Herman
That's a shell. That is all of it — you'd have a working shell with about fifty lines of C, and people do this as an exercise. The supervisory layer is what separates the toys from the real ones. The manual distinguishes synchronous from asynchronous execution: the shell waits for synchronous commands before reading more input; asynchronous ones run in parallel while the shell keeps reading. And the MIT lecture notes add the session role — the shell typically handles the login session and runs other processes. Bash doesn't just launch programs, it manages them: foreground, background, signals, when to hand you back the prompt.
Corn
That supervising is still just the ordinary calls. wait4 and friends.
Herman
Same calls ls could make if ls had ambitions. Job control, process groups, the terminal — all built out of the same nothing-special interface. Chris Down put the division of labour in one sentence I've never bettered: the job of a shell is not to encompass every available command, but to provide an environment capable of running them. The environment is the product. The commands were never the shell's.
Corn
The prompt is a landlord's lobby. Everything important happens in the apartments.
Herman
I want to land the mental model Daniel asked for, because it's worth saying in one breath. You type text. Readline hands it to Bash. Bash expands it and decides: internal — a function or a builtin, handled in place — or external. Internal means the work never leaves the process. External means fork, then the child calls execve with a path, an argv and an envp, and the parent parks in wait4 until the kernel hands back a status word that becomes dollar-question. The kernel does everything else: the loading, the scheduling, the memory, the file descriptors, the signals. Bash is a text processor and a supervisor with no privileges of its own.
Corn
The deflation is the payoff. The reason "abstraction over the operating system" feels wrong once you see the trace is that the kernel interface underneath is almost boringly uniform. Every program on the machine is making the same handful of requests. The thickness was never depth of authority — it was width of vocabulary.
Herman
Width of vocabulary, that's... yes. Better than the phrase Daniel used, honestly. The shell's thousand conveniences all compile down to the same three verbs.
Corn
We traced a Python print down through six layers once, years ago — this is the same instinct from the other end of the pipe. Start at the shell, walk down to the syscall boundary instead of starting at a print statement and walking down. Both trips end at the same place: a program asking the kernel, politely, over and over.
Herman
Every layer between is a convenience somebody wrote because they were tired. Including Bash.
Hilbert
Which of you said the line editor wasn't Bash?
Corn
That'd be me.
Hilbert
Then you were the closest, and Herman buried it. The typing is half the experience and it isn't the shell's work at all. I've carried an inputrc file across — let me think — six machines now, and I can tell you the binding changes the shell more than any bashrc ever did. Tab is where the man left it. I put the up-arrow on the reverse history search a long time ago, so the shell stops pretending it's a typewriter. Herman was going on about wait and the status word — the part I actually use is the part where readline reaches back through ten years of my own typing and finds the line. That's the shell I know. The kernel never sees any of it.
Herman
That's true, though — search-as-you-type history is entirely readline. It never crosses the boundary.
Hilbert
Of course it doesn't. The keyboard and I have an arrangement, the shell is just the man in the middle. The man at the terminal shop on Jaffa Road told me my key was broken, incidentally. He said bring the keyboard in. I told him it was a binding question, not a hardware question, and he charged me for the diagnostic anyway, which I have the receipt for. Forty shekels. I keep the receipt in the file with the inputrc, both together, that's the proper order of things.
Corn
The receipt and the config file, filed together.
Hilbert
Where else. One's the proof and one's the working part, and I'm not losing either to a machine that asks a kernel whether it's talking to a typewriter. Herman, you'd have liked the shop, though. Everything in it was made for fingers.
Herman
Everything in my career was made for fingers too, and here we are.
Hilbert
Fair. The man knew his keyboards, mind. Not the software, but the hardware, he was honest about that much.
Corn
Where does that leave the mental model?
Herman
Confirmed, mostly. He's right that the layer I slid past — the line editor — is where a huge share of the felt experience of "the shell" lives. My model had readline as a footnote, and it's closer to half the interface.
Corn
The one thing, if you take one thing from this: the next time a command seems to vanish into the machine, picture the trace. Three lines. Your shell clones, the child swaps itself out, and your shell — the program you thought was in charge — is standing in wait4, doing absolutely nothing, until the kernel tells it a number.
Herman
That number is the entire afterlife of your command. Everything else — the status, the output, the environment — was arranged before the fork or inherited across it.
Corn
Which leaves the open question I'd send back to Daniel: if the abstraction is this thin, why did it take him years to notice? My guess is that a good interface hides its own thinness — that's what makes it good.
Herman
The model transfers. The same fork, exec, wait story is underneath zsh, underneath fish, underneath anything that ever called itself a shell. He'll never need to learn it twice.
Corn
Huge thanks to our producer, Hilbert Flumingtop, who has receipts. If this was your kind of episode, go back for episode twenty-four ninety-seven, Tracing One Python Print Through six Abstraction Layers; and episode ninety-one, The Story Behind the Show. This has been My Weird Prompts — no question too obscure, no rabbit hole too deep. If you got anything out of this one, leave us a review; it's the cheapest way to keep the archive growing. Find everything at my weird prompts dot com.
Herman
We'll be back soon.
Corn
See you tomorrow, brother.

This episode was generated with AI assistance. Hosts Herman and Corn are AI personalities. It may contain errors: disclaimer · report an error