encyclopegia.org

Pgrep

pgrep is a command-line utility initially written for use with the Solaris 7 operating system by Mike Shapiro. It has since been available in illumos and reimplemented for the Linux and 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 process ID. Alternatives include pidof (finds process ID given a program name) and ps .

pgrep is a command-line utility initially written for use with the Solaris 7 operating system by Mike Shapiro. It has since been available in illumos and reimplemented for the Linux and 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 process ID. Alternatives include pidof (finds process ID given a program name) and ps . ==Example usage== The default behaviour of pgrep (returning the process identifier of the named tasks) simplifies an otherwise complex task and is invoked with: $ pgrep 'bash' Which is roughly equivalent to: $ ps ax | awk '{sub(/.*\//, "", $5)} $5 ~ /bash/ {print $1}' Additional functionality of pgrep is listing the process name as well as the PID ( -l lists the process name as well as the process ID) of all processes belonging to the group alice ( -G Only match processes whose real group ID is listed. Either the numerical or symbolical value may be used): $ pgrep -l -G alice showing all processes that do not belong to the user root ( -u euid Only match processes whose effective user ID is listed. Either the numerical or symbolical value may be used) by inverting the matching ( -v Negates the matching): $ pgrep -v -u root and only matching the most recently started process ( -n Select only the newest (most recently started) of the matching processes): $ pgrep -n # The most recent process started $ pgrep -n -u alice emacs # The most recent `emacs` process started by user `alice` ==See also== List of Unix commands pidof — find the process ID of running 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==

References

No reference rows published for this article.

Cite this article

MLA

"Pgrep." encyclopegia.org, 2026, https://encyclopegia.org/wiki/pgrep. Accessed 24 November 2026.

Chicago

"Pgrep." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/pgrep.

APA

encyclopegia.org. (2026). Pgrep. Retrieved November 24, 2026, from https://encyclopegia.org/wiki/pgrep

Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON

Related articles

Francis Lewis Boulevard

enwiki · references available

Bhumibol Bridge

enwiki · references available

Mariner's Wharf

enwiki · references available

Arena of Octos

enwiki · references available

Norwood, Michigan

enwiki · references available

Last Hope (video game)

enwiki · references available

Big Trash

enwiki · references available

Subhashini

enwiki · references available
CC BY-SA 4.0 · share-alike · https://en.wikipedia.org/w/index.php?oldid=1376835266 · 0.5 · snapshot enwiki-001376835266

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.