SimpleShell
A lightweight Unix-style command-line shell written in C. It parses user input, spawns processes, and executes commands — a hands-on implementation of core operating-system concepts like process creation, system calls, and I/O handling.
Built as part of my Operating Systems coursework to understand how a real shell works under the hood.
Features
Interactive REPL — reads, parses, and executes commands in a continuous loop Command execution via fork() and exec() system calls Built-in commands — [e.g. cd, exit, help — list whatever yours supports] Argument parsing — tokenizes input into commands and arguments Process management — parent waits for child processes to finish [Add if applicable: I/O redirection (>, <), piping (|), background execution (&)]
Tech & Concepts
Language: C Core OS concepts: process creation (fork), program execution (exec family), process synchronization (wait), system calls Environment: Linux / Unix
Getting Started
Prerequisites
A C compiler (GCC recommended) A Linux/Unix environment
Build & Run
bash# Clone the repository git clone https://github.com/Goyamjain06/simpleshell.git cd simpleshell
gcc simpleshell.c -o simpleshell
./simpleshell
Once running, type any command as you would in a normal terminal:
$ ls -l $ echo hello $ exit
Project Structure
simpleshell/ ├── simpleshell.c # Main shell: input loop, parsing, command execution ├── fib.c # [Sample program used to test the shell] └── helloworld.c # [Sample program used to test the shell]
What I Learned
How a shell uses fork() to create child processes and exec() to run programs Handling the parent–child process relationship and avoiding zombie processes Parsing and tokenizing raw user input into executable commands [Add your own line — e.g. debugging memory issues, handling edge cases in input]
Future Improvements
Support for pipes (|) and I/O redirection Command history and arrow-key navigation Tab auto-completion Background process execution with &