2

I want to check out the source code for commands such as ps. It seems to be impossible to search LXR (linux.no) for "ps". Where do I find it?

2 Answers 2

6

Ps belongs to procps-ng, git repository is here

To fetch it,

git clone https://gitlab.com/procps-ng/procps.git

6
  • Sure, but where is it in the source tree? Sep 19, 2012 at 1:44
  • @TheLegassis it's a userland tool, what you looking for?
    – daisy
    Sep 19, 2012 at 1:46
  • Hi warl0ck, so I am interested in how it gets included in every Linux build I used. Is it precompiled? I would like to take a look at the source code and modify it Sep 19, 2012 at 1:50
  • @TheLegassis yes, procps reads from /proc, proc-ps
    – daisy
    Sep 19, 2012 at 11:08
  • 1
    I think gitorious.org/procps/procps.git is outdated. Probably it has been moved to gitlab.com/procps-ng/procps/-/wikis/home, but I can't find a reliable source which proves that this is the right one. Here is the old link too fedoraproject.org/wiki/Features/procps-ng.
    – lumbric
    Jan 8, 2020 at 15:29
1

Check procps or procps-ng (the latter is used by Debian/Fedora/openSUSE/Arch and other distros).

procps is the package that has a bunch of small useful utilities that give information about processes using the /proc filesystem. The package includes the programs ps, top, vmstat, w, kill, free, slabtop, and skill.

which looks unmaintained and was forked into procps-ng

Debian, Fedora and openSUSE fork of procps. For more information about the former upstream see http://procps.sourceforge.net.

6
  • Renan, I understand.. but where would I find this in Linux source tree? Sep 19, 2012 at 1:42
  • 1
    @TheLegassis it is not in the Linux source tree (it's userland, not kernel stuff). To get the source code go to the links I gave.
    – Renan
    Sep 19, 2012 at 2:18
  • Alright, how does ps get the process information? Through /proc directory or does it use a system call? Sep 19, 2012 at 2:21
  • 2
    For that type of question, it would be best to just look at the source.
    – Jim Paris
    Sep 19, 2012 at 3:01
  • 1
    If you want to know how programs obtain information about the system you can use strace.
    – Kotte
    Sep 19, 2012 at 6:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.