Source code of sudo, su, bash, ps etc etc
FedoraForum.org - Fedora Support Forums and Community
Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2010
    Posts
    24

    Source code of sudo, su, bash, ps etc etc

    I am using Fedora 17. I want to download source code of various command in linux.
    E.g. source code of sudo, su, bash, ps and other. From where I can get it.
    Actually I got source code of sudo from http://www.sudo.ws/ but did not get source code of su from anywhere.
    How to get it ??
    Please help

    Thanks in advance.

  2. #2
    Join Date
    Aug 2009
    Posts
    8,486

    Re: Source code of sudo, su, bash, ps etc etc

    All of the source code is in the Fedora source repository, which is disabled by default.

    You can temporarily enable them and download the source. I would use yumdownloader to get the source.

    Code:
    yumdownloader --source packagename
    This will download the source rpm into the current directory. To specify a different directory, use the --destdir parameter

    Edit:

    For a lot of the basic linux commands, etc.. the package that contains them is coreutils

  3. #3
    Join Date
    Jul 2008
    Posts
    1,348

    Re: Source code of sudo, su, bash, ps etc etc

    Just to expand on what DBelton said, if you aren't sure what package something came from,
    then try this command: rpm -qf <directory or filepath>
    Example:
    Code:
    [vallimar@ava ~]$ rpm -qf /usr/bin/ps
    procps-ng-3.3.3-2.20120807git.fc18.x86_64

  4. #4
    Join Date
    Aug 2009
    Posts
    8,486

    Re: Source code of sudo, su, bash, ps etc etc

    One thing I forgot to mention above

    You can download the source to ALL of the Fedora provided applications from the Fedora repo. Fedora provides source to everything it includes in its distro. Fedora also may make changes to some code, so downloading from upstream, you may or may not get the same code.

  5. #5
    Join Date
    Oct 2010
    Posts
    24

    Re: Source code of sudo, su, bash, ps etc etc

    @vallimar, DBelton: Thanks for the reply.
    One more thing I want to ask that the code that I will get for standard Linux commands/utils will be portable code or not( only for linux distributions e.g. Ubuntu, Fedora.)
    Means for example when I downloaded the coreutils package source code as you told me. What I get is coureutils.***.src.rpm. And after extracting it, it contain one more coureutils***.tar.xz and some patch. So these patch are the change that we have to do in the original source when we want to use it for fedora.
    So can I assume that if I compile coureutils***.tar.xz on Ubuntu/Fedora 32/64 bit machine it will work fine.
    Ignore bug issue. And I am asking this only for very basic and standard command that are there in all Linux distributions.

  6. #6
    Join Date
    Aug 2009
    Posts
    8,486

    Re: Source code of sudo, su, bash, ps etc etc

    It all depends upon what the patches contain.

    Sometimes they are patches for Fedora only. Sometimes they are backported bug patches, for example to fix a major bug that hasn't been released by the upstream provider yet.

    For example, there is a bug in package version 1.1. Upstream fixes the bug in package 2.0 but it's not released yet. Sometimes Fedora grabs the patch from upstream and applies it to the 1.1 package.

    There are some packages that are pretty much Fedora only, but for the most part you can compile and run them on any linux (and some you can even cross-compile on Windows, android, etc...)

Similar Threads

  1. Bash code sample - Is this correct?
    By glennzo in forum Programming & Packaging
    Replies: 10
    Last Post: 14th November 2011, 01:10 AM
  2. [SOLVED]
    [bash] sudo sub?
    By sea in forum Programming & Packaging
    Replies: 8
    Last Post: 8th August 2011, 06:56 PM
  3. [SOLVED]
    How to Run (not Run in Terminal) bash script with sudo in it?
    By premudriy in forum Using Fedora
    Replies: 2
    Last Post: 6th July 2010, 06:56 PM
  4. Source rpm, binary rpm and source code
    By mcpoon in forum Using Fedora
    Replies: 2
    Last Post: 3rd July 2009, 04:07 PM
  5. Replies: 7
    Last Post: 30th November 2008, 12:18 AM

Tags for this Thread

Posting Permissions

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