Skip to content
Back to the catalog
Project shellSystemsIntermediateBeta

Build your own shell

fork, exec, pipes and redirection. Build a POSIX command interpreter that runs real programs.

Build it in your language

The tester treats your program as a black box: any language works. These are just the most convenient ones for this project.

Guide language

The stage guides read in this language. Only languages this project is fully translated into show up here; the interface language does not change.

What this project is about

A shell is the program you talk to your operating system with every single day: it reads a line, works out what it means and puts the kernel to work. Inside it is surprisingly small, and understanding it changes how you read a terminal error forever.

In this challenge you build your own: an interpreter that spawns real processes, chains commands with pipes, redirects input and output and returns correct exit codes. By the end you'll run ls | grep .txt > out.txt in a shell you wrote yourself.

Roadmap

12 stages across 4 phases. Every stage comes with its guide and its tests: you move on when they pass.

  1. Phase 13 stages

    The minimal loop

    Read a line, run a binary and wait for it to finish. Your first child process.

    1. 01Read commands
    2. 02fork and exec
    3. 03Wait and return status
  2. Phase 23 stages

    Built-ins and the PATH

    cd, pwd and exit, PATH lookup, and correct exit codes.

    1. 01Built-ins
    2. 02PATH lookup
    3. 03Quotes and escapes
  3. Phase 34 stages

    Pipes and redirection

    Connect processes with pipe, redirect files with dup2 and chain several commands.

    1. 01One pipe
    2. 02Chained pipelines
    3. 03Output redirection
    4. 04Input redirection
  4. Phase 42 stages

    Signals and background jobs

    A Ctrl-C that doesn't kill you, background jobs and zombie cleanup.

    1. 01Signals and foreground
    2. 02Background jobs

Before you start

An interactive command interpreter covering the essentials of POSIX: a prompt, command line parsing, built-ins (cd, exit, pwd), running binaries found on the PATH, chained pipes, input and output redirection, and foreground and background process management.

  • container-runtime
    Beta

    Build your own container

    namespaces, cgroups and chroot. Isolate a process by hand and understand what Docker does when it starts an image.

    Expert8 stages~16 hSystems
    namespacescgroupsprocesos

    Go · C · Rust

  • neural-network
    Ready to build

    A Neural Network from Scratch

    Build and train a neural network from first principles: forward pass, loss functions, and gradient descent optimization.

    Beginner6 stages~6 hSystems
    machine learningneural networksmath+1

    Python · TypeScript

  • garbage-collector
    Beta

    A garbage collector

    Mark-and-sweep from scratch. Manage memory the way the runtimes you use daily do without you noticing.

    Expert9 stages~18 hSystems
    memoriamark & sweeppunteros

    C · C++ · Rust