Try: pkill -f 'python.*worker.py'
Info: pkill matches processes using a pattern. The -f option matches against the full command line, making it useful when multiple processes run the same script with different arguments. Always preview matching processes with pgrep -af before terminating them.
Examples:
- $
pgrep -af 'ffmpeg'# Preview matching processes and full arguments - $
pkill -9 -f 'stuck-process'# Force-kill matching processes - $
pkill -u linuxteck# Terminate processes owned by a user
Note: Always preview matches with pgrep before using pkill. The default signal is SIGTERM (15), which gives processes an opportunity to exit cleanly. Use -9 (SIGKILL) only when a process does not respond to normal termination. Be especially careful with broad patterns because pkill -f can match more processes than expected.
Leave a Reply