The Full Wiki

More info on Pgrep

Pgrep: Wikis

Advertisements

Note: Many of our articles have direct quotes from sources you can cite, within the Wikipedia article! This article doesn't yet, but we're working on it! See more info or our list of citable articles.

Encyclopedia

(Redirected to pgrep article)

From Wikipedia, the free encyclopedia

pgrep is a command line utility initially written for use with the Solaris 7 operating system. It has since been reimplemented for Linux and the BSDs (Dragonfly BSD, FreeBSD, NetBSD, 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

  • pgrep(1): look up processes based on name and other attributes – Linux User Commands Manual
Advertisements

Advertisements






Got something to say? Make a comment.
Your name
Your email address
Message