↑ ↓ select, Enter open, Esc close

Kill all processes matching a name

Caution: This command changes the system. Understand what it does before you run it.

Adjust the values, the command updates live
root@server
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

Related one-liners

All in Processes

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.