Pgrep

Article on other languages:

del.icio.us del.icio.us
Digg Digg
Furl Furl
Reddit Reddit
Rojo Rojo
Add to OnlyWire

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 id(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

This article is from Wikipedia. All text is available under the terms of the GNU Free Documentation License.


Giant Panda

Mercedes Car
James Bond Guide
This site monitored by SitePinger.net