Forrest logo
back to the pgrep tool

pgrep:tldr:d9fe4

pgrep: Return PIDs of any running processes with a matching command string.
$ pgrep ${process_name}
try on your machine

The command "pgrep ${process_name}" is used to search for processes by their name and retrieve their process IDs (PIDs).

Here's a breakdown of the command:

  • "pgrep" stands for "process grep" and is a command-line utility that allows you to search for running processes based on different criteria.
  • "${process_name}" is a placeholder representing the name of the process you want to search for. This should be replaced with the actual name of the process you're interested in.
    • For example, if you want to find all processes with the name "htop", you would use: "pgrep htop".
  • When the command is executed, it will search for processes matching the specified name and display the corresponding PIDs on the console.

Note that this command will only return the PIDs of processes matching the specified name, not any additional information about the processes.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.

Questions that are answered by this command:

  • check if process exists?
back to the pgrep tool