pgrep
ProcessesFundamentals In simulator In real LinuxFind process IDs by name
Name: pgrep = process grep
You can practise it right away in the simulator, and use it in real Linux mode too.
Description
pgrep looks up processes by name or other attributes and prints their PIDs. Unlike ps | grep it never matches itself, which makes it better in scripts.
Syntax
pgrep [OPTION]... PATTERNCommon options
| -l / --list-name | Also list the process name |
| -a / --list-full | Show the full command line too |
| -f / --full | Match the full command line |
| -x / --exact | The name must match exactly |
| -u / --euid USER | Only a user's processes |
| -P / --parent PPID | Only children of PPID |
| -n / --newest | Only the newest one |
| -o / --oldest | Only the oldest one |
| -c / --count | Only how many |