Linux Shell Development

fork / exec / pipe IPC

Linux Shell Development

A custom Linux command-line shell built in C featuring process management, I/O redirection, piping, and signal handling.

About the Project

Built as a comprehensive systems programming project for COMP 3659 (Operating Systems), this project implements a custom POSIX-compliant Linux shell in C. The shell provides an interactive command-line interface that mirrors core functionality of shells like Bash, managing process hierarchies and system resources through low-level Linux system calls.

The implementation parses complex command strings into abstract execution trees, supporting tokenized arguments, path resolution, and execution via fork() and execvp(). The shell implements multi-stage inter-process communication pipelines (cmd1 | cmd2 | cmd3) using Linux pipes and file descriptor duplication (dup2()), handles input/output redirection (<, >, >>), tracks background jobs running with &, and manages OS signals like SIGINT (Ctrl+C) and SIGTSTP to protect parent shell stability.

Key Features & Engineering Highlights

  • Process lifecycle management implementing fork(), execvp(), waitpid(), and background job tracking
  • Inter-process communication (IPC) supporting multi-command pipelining via pipe() and dup2()
  • Robust I/O redirection for standard input, output, and append modes (<, >, >>)
  • Asynchronous signal handling for SIGINT, SIGTSTP, and SIGCHLD to prevent zombie processes
  • Built-in shell command implementations including cd, history, help, and exit

Related Projects

Other work that shares technologies or themes with Linux Shell Development.