A POSIX-compliant Unix shell built from scratch in C.
- Run any system command (
ls,cat,echo,pwd...) - Pipes (
ls | grep .c) - Output redirection (
echo hello > file.txt) - Input redirection (
cat < file.txt) - Built-in commands:
cd,exit,help - Prompt shows current working directory
gcc main.c -o mysh ./mysh
| Syscall | Purpose |
|---|---|
fork() |
create child process |
execvp() |
replace child with command |
waitpid() |
wait for child to finish |
pipe() |
connect two processes |
dup2() |
redirect input/output |
chdir() |
change directory |
getcwd() |
get current directory |
- How Unix processes work
- How every shell on earth works under the hood
- File descriptors and I/O redirection
- Inter-process communication with pipes