A lightweight Unix-like shell developed in C++ using POSIX system calls. MiniShell++ demonstrates core operating system concepts including process creation, command execution, pipelines, I/O redirection, background job management, signal handling, and modular shell architecture.
- β¨ Features
- π οΈ Technologies
- π Project Structure
- βοΈ POSIX System Calls Used
- π Build Instructions
- π» Usage
- π Built-in Commands
- π Sample Session
β οΈ Current Limitations- π Future Improvements
- πΈ Screenshots
- π― Learning Outcomes
- π¨βπ» Author
- π License
- Built-in Commands (
cd,history,exit) - External Command Execution
- Single-stage Pipelines (
|) - Input Redirection (
<) - Output Redirection (
>) - Append Redirection (
>>) - Background Job Execution (
&) - Signal Handling (
SIGINT,SIGCHLD) - Command History
- Filename Completion Engine (
complete <prefix>) - Modular C++ Architecture
- CMake Build System
- C++17
- POSIX System Calls
- Linux / macOS
- CMake
MiniShell++
β
βββ assets/
β βββ shell-demo.png
β βββ pipeline.png
β βββ redirection.png
β βββ background-job.png
β βββ history.png
β
βββ include/
β βββ autocomplete.h
β βββ builtin.h
β βββ command.h
β βββ executor.h
β βββ history.h
β βββ parser.h
β βββ pipeline.h
β βββ process.h
β βββ shell.h
β βββ signal_handler.h
β
βββ src/
β βββ autocomplete.cpp
β βββ builtin.cpp
β βββ command.cpp
β βββ executor.cpp
β βββ history.cpp
β βββ main.cpp
β βββ parser.cpp
β βββ process.cpp
β βββ shell.cpp
β βββ signal_handler.cpp
β
βββ tests/
βββ assets/
βββ build/
βββ CMakeLists.txt
βββ README.md
βββ .gitignore
MiniShell++ is built using core POSIX APIs.
| System Call | Purpose |
|---|---|
fork() |
Create child processes |
execvp() |
Execute external commands |
waitpid() |
Wait for child processes |
pipe() |
Inter-process communication |
dup2() |
Redirect standard input/output |
open() |
Open files for redirection |
close() |
Close file descriptors |
sigaction() |
Install signal handlers |
git clone https://github.com/Balpreet1003/MiniShell++.git
cd MiniShell++mkdir build
cd build
cmake ..
make./myshellpwd
ls -la
mkdir demo
whoamiecho hello | wc
ls | wcecho hello > out.txt
echo world >> out.txt
cat < out.txtsleep 10 &complete out| Command | Description |
|---|---|
cd |
Change current directory |
history |
Display command history |
exit |
Exit MiniShell |
myshell> pwd
/Users/balpreet_singh/Documents/MiniShell++
myshell> ls
build
include
src
README.md
CMakeLists.txt
myshell> echo hello > out.txt
myshell> cat out.txt
hello
myshell> echo world >> out.txt
myshell> cat out.txt
hello
world
myshell> ls | wc
7 7 76
myshell> sleep 10 &
[12345] Running in background
myshell> history
1 pwd
2 ls
3 echo hello > out.txt
4 cat out.txt
5 sleep 10 &
6 history
myshell> exit
This project intentionally focuses on implementing the core functionality of a Unix shell.
Currently, the following features are not supported:
- Multiple pipelines (
cmd1 | cmd2 | cmd3) - Combined pipeline and redirection
- Environment variable expansion (
$PATH) - Wildcard expansion (
*) - Quote parsing
- Command aliases
- Interactive Tab completion (uses
complete <prefix>)
Potential future enhancements include:
- Multiple pipeline support
- Environment variable expansion
- Wildcard expansion
- Quote parsing
- Interactive Tab completion using
termiosor GNU Readline - Job control (
jobs,fg,bg) - Persistent command history
- Colored shell prompt
Launch the shell and execute standard Unix commands.
./myshell
pwd
ls
whoamiecho hello | wc
ls | wcecho hello > out.txt
echo world >> out.txt
cat out.txt
cat < out.txtsleep 10 &
pwd
historyhistoryThrough this project, I gained practical experience with:
- Unix Shell Design
- Operating System Fundamentals
- POSIX System Calls
- Process Management
- Inter-Process Communication
- File Descriptor Manipulation
- Signal Handling
- Modular C++ Software Design
- CMake Build System
Balpreet Singh Gill
- GitHub: https://github.com/Balpreet1003
- LinkedIn: https://www.linkedin.com/in/balpreet-singh-gill-72374925b/
This project is developed for educational and learning purposes.




