Lost in Userland
GNU Coreutils is an excellent project, full of well tested and high quality code. But have you ever run 'ls' on that one directory full of a stupid number of files and just sat there, waiting for output? As the seconds drag on, and you wonder if it's broken, don't you also wonder exactly what it's doing, and if there's a better or more efficient way? We all rely on the functionality of common utilities like ls, cat, and cp, and many people assume that since they come with our OS, they must be doing things in the best and most efficient way possible.
After spending a little too long staring at a progress bar, wondering what exactly was happening on my system during the installation of some packages, I decided to start a project of implementing my own versions of common utilities in C++. I wanted to be able to understand how they were designed, where they came from, how they work, and if they could work even better.
The further I got with the project, the more I started to think that maybe "The UNIX-Haters Handbook" was right. The utilities that make up the "userland" we know and love for interacting with Linux and Unix systems are an odd mix of styles and idioms that have accumulated over the decades. We all think we know them pretty well. But when was the last time you actually looked at the man page for 'cat' or tried to see if 'cp' was really doing the right thing?
It turns out there there are useful lessons about the systems we work with in even the simplest of utilities. And taking closer look at some of our closest friends is a valuable experience.
Some familiarity with C, Posix APIs, C++, and some common nix command line utilities will be helpful, but high level fluency in C++ is not required.