-
-
Notifications
You must be signed in to change notification settings - Fork 1
Linux pgrep Guide
Mattscreative edited this page Dec 5, 2025
·
2 revisions
Complete beginner-friendly guide to pgrep on Linux, covering Arch Linux, CachyOS, and other distributions including finding processes by name, pattern matching, and process searching.
pgrep finds processes by name.
Uses:
- Find processes: Search for processes
- Pattern matching: Match process names
- Process search: Search running processes
- PID lookup: Get process IDs
Why it matters:
- Process finding: Find processes easily
- Pattern matching: Match multiple processes
- Process management: Manage processes
Basic usage:
# Find process by name
pgrep process-name
# Returns PIDsShow names:
# Show process names
pgrep -l process-name
# -l = list (shows name and PID)Match full command:
# Match full command line
pgrep -f "pattern"
# -f = full command lineExact name:
# Exact match
pgrep -x process-name
# -x = exact matchCount matches:
# Count processes
pgrep -c process-name
# -c = count (number of matches)Filter by user:
# Processes by user
pgrep -u username process-name
# -u = userCheck pattern:
# Verify pattern
ps aux | grep process-name
# Check if process existsThis guide covered pgrep usage, process searching, and pattern matching for Arch Linux, CachyOS, and other distributions.
- pkill Guide - Kill by name
- ps Guide - Process listing
- Process Management - Process management
-
pgrep Documentation:
man pgrep
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.