Minishell is a simplified UNIX shell developed as part of the Hive Helsinki curriculum.
It is a from-scratch implementation of core shell features like command execution,
process handling, input/output redirection, pipes, and signal handling.
This project is an exercise in system programming in C.
It showcases key low-level programming concepts, including:
- System calls:
fork(),execve(),pipe(),dup2(),waitpid(), etc. - Process control: Managing child processes, job control.
- Memory management: Avoiding leaks, handling dynamic allocations.
- File descriptors & redirections: Implementing
<,>,<<,>>. - Signal handling: Handling
SIGINT (Ctrl+C),SIGQUIT (Ctrl+\). - Environment management: Handling
$PATH, variable expansion.
✅ Execute commands like Bash
✅ Built-in commands: cd, echo, pwd, export, unset, env, exit
✅ Pipes (|): Chain multiple commands
✅ Input/output redirection: <, >, <<, >>
✅ Signal handling: Handle Ctrl-C, Ctrl-D, Ctrl-\
✅ Environment variables: $PATH, $HOME, $?, etc.
✅ Command history (via readline)
✅ Currently supports: Linux
❌ MacOS support is currently broken due to Readline differences.
- Clone the repository:
$ git clone https://github.com/liocle/minishell.git
$ cd minishell- Install dependencies:
$ sudo apt update && sudo apt install libreadline-dev libncurses-dev- Compile the project:
$ make- Run Minishell:
$ ./minishell$ ls -l # List files
$ echo Hello World # Print "Hello World"
$ export PAGER=less # Set an environment variable
$ cd /home/user # Change directory
$ cat file | grep foo > output.txt # Use pipes and redirectionsThis project deepened my understanding of C and UNIX internals, including:
- Process creation & management (fork(), execve(), waitpid())
- File descriptors (open(), close(), dup2())
- Signal handling (SIGINT, SIGQUIT, signal(), sigaction())
- Memory management (malloc(), free(), detecting leaks)
- Inter-process communication (pipe())
- I now have hands-on experience writing system-level C code and working with complex debugging scenarios.
✅ Real-world C experience → This project mimics real shell behavior, reinforcing key system programming skills.
✅ System calls knowledge → I now understand how UNIX shells execute commands, handle pipes, and manage processes.
✅ Debugging skills → Learned to debug memory leaks, segmentation faults.
✅ Handling edge cases → Unclosed quotes, invalid input, redirections, $? expansion, etc.
cdecho -npwdexportunsetenvexit
Minishell also executes any external command found in $PATH.
Want to improve Minishell? Follow these steps:
- Fork the repository.
- Create a feature branch.
- Commit your changes.
- Submit a pull request.
This project was built as part of the Hive Helsinki curriculum and is intended for educational purposes.