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.
C is arguably the most archetypical of programming languages, in the sense that seemingly all other languages are at some point or another structurally described in the context of how C-like they are. Â Also, despite all of 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 read other people’s 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 need to do is download the code and uncompress it.
Assuming you’re using a Linux box with access to the Internet, 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 uncompress the source code. Once it is uncompressed, you can cd
into the directory where it was extracted and use less
to view or vim
to open and edit the source code.