Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question
1  
Did you try -V ? :) –  val0x00ff Apr 17 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 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 at 10:48
    
@Gabriel glad you solved it. -V, --version is mentioned in the man pgrep or man pkill –  val0x00ff Apr 17 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 at 10:59

2 Answers 2

up vote 4 down vote accepted

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
share|improve this answer
    
weird thing is, it's not listed in man pgrep ... –  Gabriel Apr 17 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 at 16:18
    
i would do that if i knew how to do that :D maybe i'll look into it –  Gabriel Apr 20 at 19:32

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

% what /usr/bin/pgrep
/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.

share|improve this answer
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 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 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 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 at 11:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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