Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where do you download Linux source code? [closed]

Tags:

linux

Say I'm interested in the source for one particular Linux utility, like factor. Where can I find the source code for that utility?

like image 526
Bill the Lizard Avatar asked Jan 11 '09 20:01

Bill the Lizard


People also ask

Where can I download Linux source code?

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.

Where is Linux kernel code?

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.


2 Answers

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.

like image 67
Joachim Sauer Avatar answered Oct 03 '22 18:10

Joachim Sauer


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.

like image 26
Paige Ruten Avatar answered Oct 03 '22 17:10

Paige Ruten