This repository is a personal learning journey where I re-implement classic Linux command-line tools in C.
The goal is to understand how these commands work under the hood by rebuilding them step by step.
I’ve organized the project into stages, each focusing on a new concept:
Learn to send text to the terminal.
-
echo, print arguments
-
yes, print a string repeatedly until stopped
-
true / false, return exit code 0 or 1
Learn to open, read, and display files.
-
cat, print file contents to stdout
-
head, print first N lines of a file
-
tail, print last N lines of a file
-
wc, count lines, words, characters
Learn about paths, metadata, and file operations.
-
pwd, print current working directory
-
basename / dirname, split a file path
-
stat, show file info (size, permissions, etc.)
-
touch, create a file or update timestamp
Learn to interact with directories and their contents.
-
ls(basic), list files in current directory
-
du(basic), show size of files/directories
-
rm(basic), delete a file
-
mv(basic), rename a file
-
cp(basic), copy a file
Learn about process control and system info.
-
date, get current date/time
-
sleep, wait N seconds
-
clear, clear terminal
-
whoami, print current user
-
hostname, print machine name
-
uptime, read/proc/uptime
.
├── Final_Builds/ # Compiled binaries of finished commands
├── Stage_1/ # First commands (echo, yes, true, false)
├── Stage_2/ # File reading commands (cat, head, tail, wc)
└── ... # Future stages (filesystem, directories, system)
Each command has its own Makefile. To build, run the shell script with:
sh build_all.shthen, to try echo:
cd Final_Builds/
./my_echo "Hello World!"- Practice C programming with real-world examples
- Learn system calls like
open,read,write, andclose - Understand how Linux utilities are built step by step
- Document progress as I go
When a command is completed, its executable is stored in:
Final_Builds/
This way you can run all finished commands from one place.
This is a learning project. The reimplemented commands may not cover all edge cases or options that the GNU coreutils versions support, but they work for the basics and help me understand the internals.