I looked at the manpages and there is no -v or --version argument for pgrep or pkill. How can i get some info on the version?

I'm asking because on my version of Ubuntu man pgrep is giving me a different manual then on my server. Ideally I would install the same version on my machine too.

  • 1
    Did you try -V ? :) – Valentin Bajrami Apr 17 '14 at 10:36
  • that is the only one i didn't try, and it's not even listed in the manual!! aaargh... post it as a answer and i'll mark it as the solution :D – Gabriel Apr 17 '14 at 10:37
  • It's not? What system are you on? It's documented quite clearly on my Debian. It's the penultimate option mentioned, just above -h. – terdon Apr 17 '14 at 10:48
  • @Gabriel glad you solved it. -V, --version is mentioned in the man pgrep or man pkill – Valentin Bajrami Apr 17 '14 at 10:59
  • Ubuntu 12.04.3 LTS ... output of pgrep -V is pgrep (procps version 3.2.8) and for real it's not listed in man pgrep you can find it here pastebin.com/WDpfsuJr – Gabriel Apr 17 '14 at 10:59

You can get it by typing capital V instead of small v:

$ pgrep -V
pgrep from procps-ng 3.3.3
$ pkill -V
pkill from procps-ng 3.3.4
  • weird thing is, it's not listed in man pgrep ... – Gabriel Apr 17 '14 at 10:49
  • @Gabriel The beauty of Open Source, is you can actually add this to the manpage for that project if you are so inclined :) – David Wilkins Apr 17 '14 at 16:18
  • i would do that if i knew how to do that :D maybe i'll look into it – Gabriel Apr 20 '14 at 19:32

To get some version information, find pgrep in your PATH and run the command what. I get:

% what /usr/bin/pgrep
    PROGRAM:pkill  PROJECT:adv_cmds-149

Note that the program name is pkill. pkill and pgrep are hard links to the same binary on my system (OS X).

Explanation (from the manual):

NAME what -- show what versions of object modules were used to construct a file

DESCRIPTION what reads each file name and searches for sequences of the form "@(#)", as inserted by the source code control system. It prints the remainder of the string following this marker, up to a null character, newline, double quote, or "> character."

PS. pgrep does not accept the -v or -V flag on my system (OS X), so looking at version strings is the only option.

  • 1
    But where's the version string in the output you show? Also, what seems to be an OSX (BSD?) command, I can't find or install it on my Debian. – terdon Apr 17 '14 at 10:46
  • what is an ancient BSD command-- I remember it from literally over a decade ago. I didn't even know OS X had it until I tried. The code group and version is adv_cmds-149 -- obviously not the release tag you were looking for, but that's apparently not embedded in the OS X version. – alexis Apr 17 '14 at 10:56
  • Huh, OK. But according to the man page, that would be the version the object modules were used to construct a file, not the version of the pgrep itself then but of the libraries used to compile it right? – terdon Apr 17 '14 at 10:59
  • Object modules (.o) are compiled code, typically C code. main() lives in an object module too. A program may link together several object modules, some of them from libraries. The version you see with -V must be defined in one of the object files too -- but it's made accessible from the command line. – alexis Apr 17 '14 at 11:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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