Question: How do I get source code of any Linux command?
Answer: For Debian family Linux distributions, you can get source code for any Linux commands using one of the two methods mentioned below.
Method 1: Get Source Code Using apt-get
Step 1: Add a Source URI to sources.lst
$ cat /etc/apt/sources.list deb-src http://ftp.de.debian.org/debian lenny main
$ apt-get update
Step 2: Execute apt-get source to get the source
For example, to get source code for netstat command, do the following:
Syntax: apt-get source command-name Example: apt-get source netstat
Method 2: Get Source Code from packages.debian.org
If you are not pretty sure about the package name, you can navigate through the ‘Sections’
page here: http://packages.debian.org/stable/
- Click on the topic of the command you wanted to get the source.
- Search for the command you are looking for, and click on it.
- In the right side bar, you will have a link to download source package.
Example: Download the source code of the vim editor
- Step 1: Go to the listing page of Lenny in packages.debian.org
- Step 2: Click on the link that says ‘editors’
- Step 3: Search and go to the vim editor page
- Step 4: In the right side bar, select and download: vim_7.1.314.orig.tar.gz
Comments on this entry are closed.
I’d like to see info how to get sources in CentOS and Fedora
I basically use google code search http://www.google.com/codesearch for searching through and finding particular snippets of open source codes. Think that is also good option in addition
to the above if we just want to analyse some part and dont want to do build it.
you can always install debian in a virtualbox to get that working
@Grim
You can find package sources for centOS here: http://vault.centos.org/5.2/os/SRPMS/
Then you need just to install rpms for sources that you want.
Regards
—
Milan Cvejic
please provide for rpm packages also
@Athul,
Google code search looks great. Thanks for sharing it.
@Jameslee,
Use the method suggested above by Milan to get source code of the rpm packages (which is RedHat based). CentOS is based on RedHat code base.
Worked for thankz maan!!!!!
How can I obtain source codes for ubuntu family apart from code search?
Thank you!!! You helped me so much!!
Is there any other way for download the source for unix wait command