Loading...

Build your own Shell

Learn about parsing shell commands, executing programs and more

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

A shell is a command-line interface that executes commands and manages processes. In this challenge, you'll build your own POSIX compliant shell that's capable of interpreting shell commands, running external programs and builtin commands like cd, pwd, echo and more.

Along the way, you'll learn about shell command parsing, REPLs, builtin commands, and more.

Stages

Print a prompt
Handle invalid commands
REPL
The exit builtin
The echo builtin
The type builtin: builtins
The type builtin: executable files
Run a program

Navigation

The pwd builtin
The cd builtin: Absolute paths
The cd builtin: Relative paths
The cd builtin: Home directory

Quoting

Single quotes
Double quotes
Backslash outside quotes
Backslash within single quotes
Backslash within double quotes
Executing a quoted executable

Redirection

Redirect stdout
Redirect stderr
Append stdout
Append stderr

Autocompletion

Builtin completion
Completion with arguments
Missing completions
Executable completion
Multiple completions
Partial completions

Pipelines

Dual-command pipeline
Pipelines with built-ins
Multi-command pipelines

History

The history builtin
Listing history
Limiting history entries
Up-arrow navigation
Down-arrow navigation
Executing commands from history

History Persistence

Read history from file
Write history to file
Append history to file
Read history on startup
Write history on exit
Append history on exit