Results 1 to 10 of 21
Yes, I know that : Linux is an open source operating system
But I try to do : cat /bin/ls (for exemple) but nothing happen !
because as everyone know ...
- 01-14-2012 #1Just Joined!
- Join Date
- Jan 2012
- Posts
- 4
Where can I find source code of linux commands ?
Yes, I know that : Linux is an open source operating system

But I try to do : cat /bin/ls (for exemple) but nothing happen !
because as everyone know that ls,cat,touch.... is compiled
so I try search for an open source of linux component but I get nothing
Can you please tell me where can I find it ?
thanks
and sorry for my english
- 01-14-2012 #2
For fedora (or redhat based distros), the investigation could look like this:
1) Query, which package owns the binary:
2) Look at the meta informations of that packageCode:[irithori@fedora16 ~]$ rpm -qf /bin/ls coreutils-8.12-2.fc16.i686
Code:[irithori@fedora16 ~]$ rpm -qi coreutils Name : coreutils Version : 8.12 Release : 2.fc16 Architecture: i686 Install Date: Do 03 Nov 2011 03:28:42 CET Group : System Environment/Base Size : 14074151 License : GPLv3+ Signature : RSA/SHA256, Di 26 Jul 2011 04:30:13 CEST, Key ID 067f00b6a82ba4b7 Source RPM : coreutils-8.12-2.fc16.src.rpm Build Date : Fr 15 Jul 2011 16:09:16 CEST Build Host : x86-17.phx2.fedoraproject.org Relocations : (not relocatable) Packager : Fedora Project Vendor : Fedora Project URL : http://www.gnu.org/software/coreutils/ Summary : A set of basic GNU tools commonly used in shell scripts Description : These are the GNU core utilities. This package is the combination of the old GNU fileutils, sh-utils, and textutils packages.
This gives you the hint to the website of the package:
Coreutils - GNU core utilities
and also informs you, that there is a src.rpm coreutils-8.12-2.fc16.src.rpm
3) Look at / get the source
You can now visit the website Coreutils - GNU core utilities
4 (optional) ) Get yumdownloader
Unfortunately, yum cannot download src.rpms.
yumdownloader needs to be used, which is part of the yum-utils package:
5) Get / look at the src.rpmCode:[irithori@fedora16 ~]$ sudo yum install yum-utils
This procedure provides the exact sources/patches/specfile, that was used to build the binaries.
Code:[irithori@fedora16 ~]$ yumdownloader --source coreutils [irithori@fedora16 ~]$ rpm -i coreutils-8.12-2.fc16.src.rpm [irithori@fedora16 ~]$ ls -la ~/rpmbuild/SOURCES/ [irithori@fedora16 ~]$ ls -la ~/rpmbuild/SPECS/
For deb based distributions, the workflow is similar.
You can also always look in the man pages and the documentation for the source websites.You must always face the curtain with a bow.
- 01-14-2012 #3Just Joined!
- Join Date
- Jan 2012
- Posts
- 4
thank you Irithori for your response

OK, I understand that rpm can gives me some informations abouts packages.
so I installed rpm on backtrack (VMware) but he gives me :
my question is : rpm + "-qt" doesn't work on deb based distributions, or just on backtrack, or there is another way ?Code:root@bt:~# rpm -qf /bin/ls file /bin/ls is not owned by any package
- 01-14-2012 #4Linux Guru
- Join Date
- May 2011
- Posts
- 1,838
It seems Backtrack Linux is based on Kubuntu, based upon the FAQ. That distro uses apt-get (and dpkg) for software package management. The yum/rpm tools are used for RPM-based systems like Red Hat Enterprise Linux, Fedora, CentOS, etc.
You can use dpkg to do similar package queries that Iriothori gave you for rpm.
- 01-14-2012 #5Just Joined!
- Join Date
- Jan 2012
- Posts
- 4
aha ok ok

I get what I want.
and its like that for who want to know :
to get the name of package owning the file "ls" for example we use -S option
That means "ls" is in "coreutils"Code:root@bt:~# dpkg -S /bin/ls coreutils: /bin/ls
to get some informations about "coreutils" we use -p
thank you again Irithori and atreyu.Code:root@bt:~# dpkg -p coreutils Package: coreutils Essential: yes Priority: required Section: utils Installed-Size: 12152 Origin: Ubuntu Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> Bugs: https://bugs.launchpad.net/ubuntu/+filebug Architecture: i386 Version: 7.4-2ubuntu3 Replaces: mktemp Pre-Depends: libacl1 (>= 2.2.11-1), libattr1 (>= 2.4.41-1), libc6 (>= 2.11), libselinux1 (>= 1.32) Filename: pool/main/c/coreutils/coreutils_7.4-2ubuntu3_i386.deb Size: 2435184 MD5sum: 281a29d693b727da79f0fe17a4ceb422 Description: The GNU core utilities This package contains the essential basic system utilities. . Specifically, this package includes: basename cat chgrp chmod chown chroot cksum comm cp csplit cut date dd df dir dircolors dirname du echo env expand expr factor false fmt fold groups head hostid id install join link ln logname ls md5sum mkdir mkfifo mknod mktemp mv nice nl nohup od paste pathchk pinky pr printenv printf ptx pwd readlink rm rmdir sha1sum seq shred sleep sort split stat stty sum sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink users vdir wc who whoami yes Original-Maintainer: Michael Stone <mstone@debian.org> SHA1: b9c65407cda75a7e4ecc25f75e642d032d547b98 SHA256: f4a344340050d8ebdaffe87447d3967955d52210bd319255ad8702eda65b1df8 Supported: 5y Task: minimal
- 01-18-2012 #6Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,970
All distributions have mirror sites where you can access and download source packages for the kernel as well as all of the applications in their repositories. Also, most Linux utilities are GNU tools, and those you can access/download from www.gnu.org, though their site is participating in the "No SOPA" protest today and will be dark until midnight - probably US Eastern Standard Time.
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 01-19-2012 #7Guest
- Join Date
- Feb 2005
- Posts
- 314
If you just want to grab the source on a Debian based distro
Where "package-foo" substitute the relevant package name.Code:apt-get source package-foo
Note: -
You do not need to be root.
You need "deb-src" lines listed in your apt sources.
- 01-19-2012 #8Linux Guru
- Join Date
- May 2011
- Posts
- 1,838
- 01-19-2012 #9
- 01-20-2012 #10Linux Guru
- Join Date
- May 2011
- Posts
- 1,838


3Likes
Reply With Quote
