A lightweight Unix-like shell implemented in C using POSIX system calls. This project demonstrates fundamental operating system concepts such as process creation, inter-process communication, file descriptor management, and signal handling.
- Execute external commands using
fork()andexecvp() - Built-in commands:
cdpwdhelpexit
- Input redirection (
<) - Output redirection (
>) - Append output redirection (
>>) - Command pipelines (
|) - Background process execution (
&) - Signal handling (
Ctrl+C/SIGINT) - Modular command parsing and execution
- C
- POSIX System Calls
- GCC
- Linux
- Process Creation (
fork) - Program Execution (
execvp) - Parent-Child Process Synchronization (
wait,waitpid) - Pipes and Inter-Process Communication (
pipe) - File Descriptor Duplication (
dup2) - File Operations (
open,close) - Signal Handling (
sigaction) - Input/Output Redirection
Compile using GCC:
gcc shell.c -o shell./shellExample prompt:
Madhan-Shell :>
lscd Documentspwdsort < input.txtls > files.txtecho Hello >> output.txtcat file.txt | grep hello | wc -lsleep 10 &.
├── shell.c
└── README.md
- Command history
- Tab completion
- Environment variable expansion
- Wildcard (
*) support - Job control (
jobs,fg,bg) - Command chaining (
&&,||,;) - Quote-aware command parsing
This project provided hands-on experience with:
- Process management in Unix/Linux
- Inter-process communication
- Shell command parsing
- File descriptor manipulation
- Signal handling
- POSIX programming
This project is open source and available under the MIT License.