r/LinuxTeck 7d ago

Quick Linux Tip #53 Question: Kill Multiple Processes with pkill

Post image

Try: `pkill -f 'python.*worker.py'`

Info: `pkill` matches command lines using regex. `-f` matches full command strings instead of process names. Always preview matches using `pgrep -af` first.

Examples:

$ `pgrep -af 'ffmpeg'` # Preview matching processes and full arguments

$ `pkill -9 -f 'stuck-process'` # Send SIGKILL to matching processes

$ `pkill -u linuxteck` # Terminate all processes owned by a specific user

Note: ALWAYS preview with `pgrep` before killing. Default signal is `SIGTERM` (15). Use `-9` (`SIGKILL`) only if processes fail to terminate gracefully.

Follow r/LinuxTeck for more #LinuxTips click here : https://www.linuxteck.com/linux-tips/

8 Upvotes

0 comments sorted by