Kill all processes matching a name
kill all php processes | kill processes by name | pkill with pattern | stop hanging scripts | pkill | pgrep | killCaution: This command changes the system. Understand what it does before you run it.
pgrep -af "wp-cron.php" && pkill -f "wp-cron.php"pgrep -af first shows all matching processes with PID and full command line, then pkill -f sends them SIGTERM. If there is no match, pkill is not run at all. Useful when many identical scripts have piled up.
Note: -f matches against the entire command line, so a pattern that is too short like php also hits php-fpm and can take down all websites. Without root, only your own processes are terminated.
Also searched as
- kill all php processes
- kill processes by name
- pkill with pattern
- stop hanging scripts