Share on Facebook Share on Twitter Email
Answers.com

Pgrep

 
Wikipedia: Pgrep

pgrep is a command line utility initially written for use with the Solaris 7 operating system. It has since been reimplemented for Linux and OpenBSD. It searches for all the named processes, that can be specified as extended regular expression patterns, and, by default, returns their ID. Alternatives include pidof and ps.

Example usage

pgrep's default behaviour (returning the process identifier(s) of the named task(s)) is invoked by typing:

pgrep taskname

This is roughly equivalent to the following command:

ps ax | grep taskname | grep -v grep | awk '{print $1}'

Hence, pgrep simplifies an otherwise complex task. pgrep also has additional functionality, e.g.:

  • Show all processes (in long form, ID and name) belonging to the other group:
pgrep -l -G other
  • Show all process not belonging to root user:
pgrep -v -u root

See also

  • List of Unix programs
  • pkill – signal processes based on name and other attributes
  • ps – display the currently running processes
  • grep – search for lines of text that match one or many regular expressions

References


Search unanswered questions...
Enter a question here...
Search: All sources Community Q&A Reference topics
 
 
Learn More
Pidof
Ps (Unix)
Timex (Unix)

Post a question - any question - to the WikiAnswers community:

 

Copyrights:

Wikipedia. This article is licensed under the Creative Commons Attribution/Share-Alike License. It uses material from the Wikipedia article "Pgrep" Read more

 

Mentioned in