community man page

pgrep

Find processes by name.

10 examples·source: tldr · CC-BY·status: verified
Reading is open to everyone. Suggesting a flag, fixing an example or adding a recipe is opening to verified-email accounts soon — every change is moderated before it goes live.
curl https://curlhub.sh/man/pgrep
same page, in your terminal

Examples

Return PIDs of any running processes with a matching command string GNU

pgrep process_name

Also display the full command GNU

pgrep [-a|--list-full] process_name

Search for processes including their command-line options GNU

pgrep [-f|--full] "process_name parameter"

Search for processes run by a specific user GNU

pgrep [-u|--euid] username process_name

Return PIDs of any running processes with a matching command string

pgrep process_name

Print the process name in addition to the PID (long output)

pgrep -l process_name

Match processes against the full argument list instead of just the process name

pgrep -f "process_name parameter"

Print the PID together with the full argument list for each match

pgrep -fl "process_name"

Search for processes run by a specific user (effective UID)

pgrep -u username process_name

Select only the newest (most recently started) matching process

pgrep -n process_name