Simple Shell - Minimal Unix Command Interpreter
A lightweight Unix-like shell written in C. It supports PATH resolution, builtins (cd, exit, env, setenv, unsetenv, help, history), command chaining (&&, ||, ;), aliases, comments, and variable replacement. Designed for Ubuntu 20.04 and built with gcc.

Technologies Used
Simple Shell
A lightweight Unix-like command interpreter implemented in C, designed to mirror the essential behavior of early Unix shells while remaining intentionally minimal. The project focuses on core process control, parsing, and environment management, providing a clean foundation for understanding how shells work under the hood.
Overview
Simple Shell reads user input, tokenizes commands, resolves executables using the PATH, and executes programs in child processes. It supports common shell behaviors such as chaining, comments, and aliases, alongside a practical set of built-in commands for environment and session control.
Key Capabilities
- Command execution: runs external programs via
fork()+execve() - PATH resolution: locates executables using the
PATHenvironment variable - Builtins:
cd,exit,env,setenv,unsetenv,help,history - Chaining: supports
;,&&, and|| - Comments: ignores content after
# - Aliases: define and expand custom command aliases
- Variable replacement: expands environment variables in input
Architecture Highlights
- Parser and tokenizer: handle command splitting and argument extraction
- Execution engine: dispatches builtins or forks external commands
- Environment layer: maintains a linked-list representation of
environ - History manager: persists and reloads command history
Usage
Compile
gcc -Wall -Werror -Wextra -pedantic -std=gnu89 *.c -o simple_shell
Run (interactive)
./simple_shell
Run (non-interactive)
echo "ls -l; pwd" | ./simple_shell
Example Session
$ ./simple_shell
simple_shell$ ls
file1.c file2.c README.md
simple_shell$ cd ..
simple_shell$ pwd
/home/user/projects
simple_shell$ setenv MYVAR Hello
simple_shell$ echo $MYVAR
Hello
simple_shell$ exit
Requirements
- Ubuntu 20.04 LTS (or compatible Linux)
- GNU Compiler Collection (gcc)
- Standard POSIX system calls
Design Goals
- Minimal and readable codebase for learning purposes
- Accurate core shell behavior without unnecessary complexity
- Portable and standards-based (GNU89 + POSIX)
License
Open source; free to use and modify.
Interested in working together?
I'm always open to discussing new projects and opportunities.