Systems

Mini Shell in C

A small Unix shell in C that parses commands, runs external programs with fork(), execvp() and waitpid(), and handles cd, pwd, help and exit as built-ins. It catches SIGINT and SIGTSTP so Ctrl+C and Ctrl+Z stop the foreground child without killing the shell.

Stack
C, POSIX
Code
github.com/ADM1SH/mini-shell

Overview

Install

Start the interactive shell:

./myshell

Example Session

myshell> pwd
~/mini-shell
myshell> ls -la
total 168
drwxr-xr-x  5 user  staff    160 Sep 14 16:15 .
-rw-r--r--  1 user  staff   4321 Sep 14 16:15 SPECIFICATION.md
-rw-r--r--  1 user  staff   2890 Sep 14 16:16 README.md
-rw-r--r--  1 user  staff   5820 Mar  8 2026 main.c
-rwxr-xr-x  1 user  staff  34120 Sep 14 16:15 myshell
myshell> cd ..
myshell> pwd
~
myshell> help
Mini Shell built-in commands:
  cd <dir>  - Change directory
  pwd       - Print working directory
  help      - Show help menu
  exit      - Exit the shell
myshell> exit

Updates

  • docs: update README with comprehensive documentation
  • docs: expand README to open source standards
  • docs: add detailed README with project overview and build instructions
  • docs: Add detailed comments throughout source code
  • docs: Update README and SPECIFICATION to reflect final state
  • feat: Add history built-in command
  • feat: Add help and clear built-in commands
  • feat: Add .myshellrc startup script
  • feat: Add environment variable expansion
  • fix: Handle state-changing built-ins in parent process

Docs

The full documentation covers how it works, configuration and results.