This C program demonstrates inter-process communication and pipe handling in a UNIX environment. It creates two child processes from one parent process, using fork()
and pipe()
. The first child executes the ls
command and the second executes the nl
command, with the output of ls
being piped as input to nl
.
- Utilizes
fork()
for process creation. - Implements
pipe()
for inter-process communication. - Employs
dup2()
for file descriptor duplication. - Executes external commands (
ls
andnl
) usingexecvp()
.
This custom shell program in C offers various UNIX shell functionalities, including clearing the screen, listing directory contents, and handling directories and files. It showcases the usage of system calls and process management in a shell environment.
- Implements a basic shell interface.
- Executes commands like
clear
,mkdir
, andchdir
. - Custom
cmd_tree()
andcmd_list()
functions for directory manipulation and file listing. - Utilizes
stat()
for file information retrieval, replicatingls -l
functionality.
Each project encapsulates key concepts of operating systems, demonstrating process management, file handling, and system call usage, essential for understanding the internal workings of an OS.