Skip to content
Tech Atlas, home
Search
Esc
  • All roadmapsBrowse every learning path
  • ExploreFind a technology area
  • ProjectsGuided projects and builds
  • My AtlasYour learning dashboard
Practice build · Operating systems and the machine

Build your own Shell

A Unix shell that reads a command line, runs programs, and wires up pipes and redirection.

  • Intermediate
  • About 8–16 h
  • 5 checkpoints
  • 4 tutorials · C, Rust

Pick a tutorial, then check yourself at each checkpoint. Work in any language you like.

Choose a tutorial

Why build it

Every terminal session runs through fork, exec and wait. Writing the loop yourself shows how processes are created, how file descriptors are inherited, and why cd has to be a built-in.

You will be able to

  • Create processes with fork and exec (or your language's spawn API) and reap them with wait.
  • Explain how file-descriptor inheritance makes pipes and redirection work.
  • Tell built-ins from external programs and say why cd and exit must be built-ins.
  • Handle signals so that Ctrl-C stops the running program, not the shell.

Skills it exercises

Recommended on DevOps Engineer and Operating Systems & Linux.

Checkpoints

How you know you are there

Work in any language. Each checkpoint ends with something you can run or observe, so you can check it yourself.

  1. Checkpoint 1Self-check

    Read-eval loop

    Done when: The shell prints a prompt, splits the line into words, runs ls -l /tmp, waits for it and prompts again; Ctrl-D exits cleanly.

  2. Checkpoint 2Self-check

    Built-ins

    Done when: cd, pwd and exit work as built-ins, cd with no argument goes to $HOME, and an unknown command prints an error without ending the shell.

  3. Checkpoint 3Self-check

    Redirection

    Done when: sort < in.txt > out.txt and cmd 2> err.log produce the same files as bash on the same input.

  4. Checkpoint 4Self-check

    Pipelines

    Done when: cat words.txt | sort | uniq -c | sort -nr | head -3 matches bash, and ps shows no zombie processes afterwards.

  5. Checkpoint 5Self-check

    Signals and exit status

    Done when: Ctrl-C interrupts a running sleep 30 but not the shell, and the last exit status is available (as $? or similar).

Stretch goals

  • Job control: &, jobs, fg and bg.
  • Quoting and environment-variable expansion.
  • A test script that compares your shell's output with bash for 20 command lines.
Follow a tutorial

Step-by-step guides

Pick one in a language you know (tutorial languages: C, Rust). They open on the author’s site.

Where to go next

Practice builds are self-paced: Tech Atlas does not track them or count them as evidence. To show a skill, take its knowledge check from the skill page.

Tutorials come from codecrafters-io/build-your-own-x (CC0, snapshot of 2026-07-14, commit aa17439; links checked on 2026-10-19). Each tutorial belongs to its author and keeps its own licence; Tech Atlas links to it and does not host it. Briefs, checkpoints and the mapping to skills are Tech Atlas editorial drafts.