A powerful and extensible shell written in C for Linux/macOS. Supports advanced shell features such as piping, redirection, alias persistence, job control, environment variable expansion, command substitution, scripting, colored output, and more.
- Command Execution: Run any Linux command like
ls,echo,cat, etc. - Built-in Commands: Includes
cd,exit,alias - Piping (
|): Connect commands likels | grep txt - I/O Redirection (
>,<): Output to or input from files - Background Jobs (
&): Run commands without blocking the shell - Command Chaining: Logical operators:
&&,||, and; - History Support: GNU
readlinebased up/down navigation - Tab Completion: Autocomplete for files and commands
- Alias Support + Persistence: Define aliases, saved to
~/.mini-shellrc - Colored
lsOutput: Automatically adds--color=autofor clarity - Environment Variable Expansion: Supports
$HOME,$USER, etc. - Command Substitution (
$(...)): Replace with output of another command - Job Control:
jobs,fg,bg,kill - Script Execution: Run a
.txtfile with multiple shell commands - Colored Prompt: Green
mini-shell$prompt with ANSI codes - Runtime Timer: Show execution time for each command
- GCC or Clang
- GNU
readlinelibrary - Linux/macOS terminal
make
make clean
./mini-shell # Start interactive shell
./mini-shell script.txt # Run commands from a file
echo Hello
cd /
pwd
alias ll='ls -l'
ll
echo $USER
echo Home: $HOME
echo Today is: $(date)
ls | grep .c
echo Hello > file.txt
cat < file.txt
sleep 5 &
true && echo success
false || echo fallback
echo First ; echo Second
sleep 10 &
jobs
fg %1
bg %1
kill %1
Create script.txt:
echo Starting script...
ls
echo Done!
Then run:
./mini-shell script.txt
- Aliases are saved to
~/.mini-shellrc - Loaded automatically each time the shell starts
Example .mini-shellrc:
alias ll=ls -l
alias gs=git status
mini-shell/
├── src/
│ ├── main.c
│ ├── parser.c
│ ├── executor.c
│ ├── builtins.c
│ ├── piping.c
│ ├── redirection.c
│ ├── history.c
│ ├── aliases.c
│ ├── chaining.c
│ ├── timer.c
│ ├── script.c
│ ├── jobs.c
├── include/
│ └── shell.h
├── Makefile
├── .gitignore
└── README.md
mini-shell
*.o
*.out
.DS_Store
.history
.mini-shellrc
Siddharth Sivalanka
Built as a full-featured first-year systems project to explore C, POSIX, Linux internals, and interactive shell design.