It is said that the best way to learn how to program is to read and modify other people’s code. Through an open, relatively uninhibited distribution of code, the open source community inherently promotes this learning method.
The C programming language is arguably the most archetypal of programming languages, in the sense that seemingly all other programming languages are at some point structurally described in the context of how C-like they are. Also, despite all its quirks and shortcomings, some of the most powerful software in the world is written in C. For this reason, I propose that the best way to learn programming is to not just read other people’s code, but to narrow scope and read other people’s working C code.
The largest and most successful C-based open source project is GNU/Linux, and more specifically, the various small utilities that comprise it. The UNIX philosophy (a philosophy that naturally flowed into Linux development) clearly states that the best way to design a system is to write small specialized modules and connect these modules in a clear fashion. The implications of this are a great boon for anyone who wishes to analyze or modify the Linux source code, as it means they’ll only need to pay mental attention to small modules of code at any given time.
The Linux kernel source code is made available on various websites and FTP servers, but the primary location for acquiring this code is http://www.kernel.org/. A link to the latest stable version of the Linux kernel source code is always featured on this page. All you must do is download the code and decompress it.
Assuming you’re using a Linux-based operating system with Internet access and
wget installed, you can download the code by running the following commands (replacing the version number with the version you’re downloading):
regularuser@smalleycreative:~$ wget http://www.kernel.org/pub/linux/kernel/[version]/linux-[version].tar.bz2 regularuser@smalleycreative:~$ tar xvjf linux-[version].tar.bz2
These two commands will download and decompress the source code archive. Once it is decompressed, you can
cd into the directory where it was extracted and use the
less utility to view or
vim to open and edit the source code.