Overview
This project is a custom-built shell written entirely in C. It mimics the behavior of a Unix terminal, supporting basic built-in commands (cd
, exit
, etc.), piping (|
), input/output redirection (<
, >
), and background execution (&
). It was built to deepen my understanding of process creation, forking, and inter-process communication in operating systems.
Features
- Command parsing and tokenization
- Execution of built-in and external commands
- Support for I/O redirection (
<
,>
) - Support for pipelines (
|
) - Background execution (
&
)
Demo
Here's a quick demo of the shell in action:

Sample Code
void parse_command(char *command, struct pish_arg *arg)
{
// TODO
// 1. Clear out the arg struct
// 2. Parse the `command` buffer and update arg->argc & arg->argv.
arg->argc = 0;
char *token = strtok(command, " \t\n");
while (token != NULL && arg->argc < MAX_ARGC - 1) {
arg->argv[arg->argc++] = token;
token = strtok(NULL, " \t\n");
}
arg->argv[arg->argc] = NULL;
}
Explore the Code
Check out the full project on GitHub, or download it directly.
What I Learned
This project strengthened my understanding of how Unix systems manage processes. I learned how to fork child processes, manipulate file descriptors for I/O redirection, and implement a command parser from scratch.