minishell is a simplified Unix shell built from scratch in C as part of the 42 curriculum.
It handles command parsing, execution with execve, pipes, redirections,
environment variables, built-in commands (echo, cd, pwd,
export, unset, env, exit),
signal handling, and proper error management. It teaches how shells really work under the hood.
About the project
minishell is a 42 Berlin project that recreates a functional Unix shell in C. The goal is not to build a production shell, but to understand how bash actually works: parsing user input into tokens, forking child processes, executing binaries with execve, wiring up pipes and redirections, and managing environment state across commands.
Technical challenges
Command parsing is deceptively complex. Quoted strings, heredocs, and mixed operators must be tokenized correctly before execution. Pipes require coordinating multiple child processes with proper file descriptor inheritance, and signal handling must distinguish between signals sent to the shell versus signals sent to foreground child processes — getting this wrong produces hung terminals or orphaned processes.
Built-in commands (cd, export, unset, env, exit) run in the parent process and cannot be forked like external binaries. Error handling must cover missing binaries, permission failures, and syntax errors without crashing the shell loop.
What this taught me
Building a shell demystifies every debugging session that follows. When a pipeline fails or a process hangs, you understand what the operating system is doing underneath. That systems-level intuition — how processes, file descriptors, and signals interact — carries directly into backend engineering and data pipeline orchestration.
Try it out
Type help for a list of available commands.