Find the answer to your Linux question:
Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 21
Like Tree3Likes
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 ...
  1. #1
    Just Joined!
    Join Date
    Jan 2012
    Posts
    4

    Question 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

  2. #2
    Linux Guru Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    2,096
    For fedora (or redhat based distros), the investigation could look like this:

    1) Query, which package owns the binary:
    Code:
    [irithori@fedora16 ~]$ rpm -qf /bin/ls
    coreutils-8.12-2.fc16.i686
    2) Look at the meta informations of that package
    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:
    Code:
    [irithori@fedora16 ~]$ sudo yum install yum-utils
    5) Get / look at the src.rpm
    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.
    elija and lacamoura like this.
    You must always face the curtain with a bow.

  3. #3
    Just 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 :
    Code:
    root@bt:~# rpm -qf /bin/ls
    file /bin/ls is not owned by any package
    my question is : rpm + "-qt" doesn't work on deb based distributions, or just on backtrack, or there is another way ?

  4. #4
    Linux 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.
    lacamoura likes this.

  5. #5
    Just 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
    Code:
    root@bt:~# dpkg -S /bin/ls
    coreutils: /bin/ls
    That means "ls" is in "coreutils"

    to get some informations about "coreutils" we use -p
    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
    thank you again Irithori and atreyu.

  6. #6
    Linux Guru Rubberman's Avatar
    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!

  7. #7
    Guest
    Join Date
    Feb 2005
    Posts
    314
    If you just want to grab the source on a Debian based distro

    Code:
    apt-get source package-foo
    Where "package-foo" substitute the relevant package name.

    Note: -

    You do not need to be root.

    You need "deb-src" lines listed in your apt sources.

  8. #8
    Linux Guru
    Join Date
    May 2011
    Posts
    1,838
    Quote Originally Posted by caravel View Post
    If you just want to grab the source on a Debian based distro

    Code:
    apt-get source package-foo
    Where "package-foo" substitute the relevant package name.

    Note: -

    You do not need to be root.

    You need "deb-src" lines listed in your apt sources.
    This is a cool capability, and one of the few things that I like about apt-get that is not available in yum (since I last tried anyway).

  9. #9
    Linux Guru Rubberman's Avatar
    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
    Quote Originally Posted by atreyu View Post
    This is a cool capability, and one of the few things that I like about apt-get that is not available in yum (since I last tried anyway).
    Actually it is, but usually you have to edit the .repo files in /etc/yum.repos.d to enable the source repositories. After that, it is trivial.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  10. #10
    Linux Guru
    Join Date
    May 2011
    Posts
    1,838
    Quote Originally Posted by Rubberman View Post
    Actually it is, but usually you have to edit the .repo files in /etc/yum.repos.d to enable the source repositories. After that, it is trivial.
    Excellent...(said like Mr Burns while drumming fingers)
    off to research yum...thanks for the tip, rubberman!

Page 1 of 3 1 2 3 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...