This repository contains a custom Unix-style shell implemented in C, designed to replicate core behaviors of standard command-line shells. The shell provides an interactive environment for executing both built-in and external commands, with support for process management, signal handling, job control, and I/O operations.
The project focuses on low-level systems programming concepts and closely follows Unix process and signal semantics.
The shell launches an interactive prompt and continuously waits for user input. It parses commands, determines whether they are built-in or external, and executes them accordingly.
Key capabilities include:
- Foreground and background process execution
- Command parsing and argument handling
- Signal handling for interrupts and job control
- Process inspection and management
- Input/output redirection and piping
Changes the current working directory. Supports:
...~(home directory)-(previous directory)
Lists directory contents with support for:
-a: show hidden files-l: detailed listing
Output is color-coded for improved readability.
Maintains a history of recently executed commands. Supports:
- Viewing command history
- Executing commands from history
- Clearing stored history
Displays information about a given process, including:
- Process ID
- Execution status
- Memory usage
- Executable path
Searches for files or directories with optional filters:
-d: directories only-f: files only-e: exact match
Lists currently running background processes started by the shell.
Fetches and displays manual pages from an online source.
fg: Bring a background process to the foregroundbg: Resume a stopped process in the background
The shell supports basic job control and signal handling:
- Ctrl + C : Interrupts the currently running foreground process
- Ctrl + Z : Stops the foreground process and moves it to the background
- Ctrl + D : Exits the shell after cleanup
To compile the shell, run:
makeTo start the shell:
./shell- GCC compiler
- POSIX-compliant operating system
- Minimal and modular C code
- Explicit and careful use of system calls
- Emphasis on correctness and clarity
- Designed for extensibility rather than production deployment
- No advanced shell scripting support
- Limited job control compared to full-featured shells like Bash
- No tab completion or configurable prompts
- Basic error handling
-Persistent command history across sessions
- Tab completion
- Environment variable support
- Improved diagnostics and error reporting