Say I'm interested in the source for one particular Linux utility, like factor
. Where can I find the source code for that utility?
The current Linux source code is always available in both a complete tarball (an archive created with the tar command) and an incremental patch from the official home of the Linux kernel, http://www.kernel.org.
At the very top level of the source tree /usr/src/linux you will see a number of directories: arch. The arch subdirectory contains all of the architecture specific kernel code.
You can also find out which package the binary comes from an download that packages source code.
On Debian (and Ubuntu and anything else that's based on Debian) you do that like this:
$ dpkg -S /usr/bin/factor coreutils: /usr/bin/factor $ apt-get source coreutils
The first command will check which package contains the file you are searching for (use "which factor
" to find out which binary is executed when you just type "factor
").
The second command will download and unpack the sources (including the patches applied to build the package) to the current directory, so it should be executed in a dedicated or temporary directory.
I'm pretty sure rpm
-based distributions have a similar mechanism, but I don't know their commands.
What I did was type
man factor
and went to the bottom and found 'GNU coreutils 6.10'. So I googled 'coreutils' and... found the site joschi just linked to.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With