A lightweight, minimalistic command-line shell implemented in C, designed to execute Unix-like commands on Windows and Unix-like platforms.
Supports essential shell functionalities including built-in commands, background jobs, piping, and I/O redirection.
✅ Built-in commands: cd, pwd, exit, history, and on Windows: jobs, kill, fg
✅ Background execution using &
✅ Command piping (|) to chain commands
✅ Input & output redirection (<, >)
✅ Basic job control (Windows only)
✅ Persistent command history (history/command_history.txt)
✅ Cross-platform support, primarily Windows
| File | Description |
|---|---|
src/main.c |
Main program & user input loop |
src/utils.c |
Helper utility functions |
src/builtins.c |
Built-in shell commands implementation |
src/executor.c |
Command execution & process management |
src/jobs.c |
Background job control (Windows only) |
src/history.c |
Command history management |
src/parser.c |
Placeholder for advanced parsing |
include/utils.h |
Utility function declarations |
Make sure you have GCC installed.
gcc -o myshell src/main.c src/utils.c src/builtins.c src/executor.c src/jobs.c src/history.c- ✅ Recommended to compile & run on Windows for full job control functionality.
- On Unix-like systems, it works for general commands but without
jobs,fg, andkill.
Run your shell executable:
./myshell-
Basic commands
pwd cd <directory> dir exit history
-
Run in background
notepad & -
Piping
dir | find "txt"
-
Redirection
dir > output.txt type < input.txt
-
Job control (Windows only)
jobs kill <job_id> fg <job_id>
- On Windows,
pwdmight not be recognized — useecho %cd%. jobs,kill,fgonly work on Windows.- Command history is saved at
history/command_history.txt. - Parser is currently a placeholder; does not support complex syntax or scripting.
- Intended primarily for educational purposes & simple shell operations.
For queries or suggestions, feel free to reach out or open an issue.