Loading...

Build your own Shell

Learn about parsing shell commands, executing programs and more

Start Building
shell
TypeScript
shell
C
shell
C++
shell
Elixir
shell
Java
shell
JavaScript
shell
Kotlin
shell
Zig
shell
C#
shell
Go
shell
PHP
shell
Python
shell
Ruby
shell
Rust
shell
Gleam

Build your own Shell is free this October.

The core challenge experience is completely free this month. If you'd like to enjoy advanced features such as running turbo tests, dark mode, or unlimited code examples, you'll need a membership.

A shell is the program that interprets what you type into the terminal. It reads your commands, runs programs, and prints their output. Popular examples are Bash and ZSH.

In this challenge, you'll build your own shell from scratch.

Your shell will run a REPL, parse commands, spawn processes, and more.

What exactly will I build?
What exactly will I learn?
Why should I build such a project?
What are the pre-requisites for this challenge?

Stages

Print a prompt
Login via GitHub to view this stage
Handle invalid commands
Login via GitHub to view this stage
Implement a REPL
Login via GitHub to view this stage
Implement exit
Login via GitHub to view this stage
Implement echo
Login via GitHub to view this stage
Implement type
Login via GitHub to view this stage
Locate executable files
Login via GitHub to view this stage
Run a program
Login via GitHub to view this stage

Navigation

The pwd builtin
Login via GitHub to view this stage
The cd builtin: Absolute paths
Login via GitHub to view this stage
The cd builtin: Relative paths
Login via GitHub to view this stage
The cd builtin: Home directory
Login via GitHub to view this stage

Quoting

Single quotes
Login via GitHub to view this stage
Double quotes
Login via GitHub to view this stage
Backslash outside quotes
Login via GitHub to view this stage
Backslash within single quotes
Login via GitHub to view this stage
Backslash within double quotes
Login via GitHub to view this stage
Executing a quoted executable
Login via GitHub to view this stage

Redirection

Redirect stdout
Login via GitHub to view this stage
Redirect stderr
Login via GitHub to view this stage
Append stdout
Login via GitHub to view this stage
Append stderr
Login via GitHub to view this stage

Autocompletion

Builtin completion
Login via GitHub to view this stage
Completion with arguments
Login via GitHub to view this stage
Missing completions
Login via GitHub to view this stage
Executable completion
Login via GitHub to view this stage
Multiple completions
Login via GitHub to view this stage
Partial completions
Login via GitHub to view this stage

Pipelines

Dual-command pipeline
Login via GitHub to view this stage
Pipelines with built-ins
Login via GitHub to view this stage
Multi-command pipelines
Login via GitHub to view this stage

History

The history builtin
Login via GitHub to view this stage
Listing history
Login via GitHub to view this stage
Limiting history entries
Login via GitHub to view this stage
Up-arrow navigation
Login via GitHub to view this stage
Down-arrow navigation
Login via GitHub to view this stage
Executing commands from history
Login via GitHub to view this stage

History Persistence

Read history from file
Login via GitHub to view this stage
Write history to file
Login via GitHub to view this stage
Append history to file
Login via GitHub to view this stage
Read history on startup
Login via GitHub to view this stage
Write history on exit
Login via GitHub to view this stage
Append history on exit
Login via GitHub to view this stage