Linux – How to kill all processes returned by pgrep

killlinuxprocessUbuntu

I need to kill a few Python processes. I can get a list of the process numbers using pgrep python, but how can I kill them all at once instead of killing one by one?

I'm looking for something like:

pgrep python | kill process_nos

Best Answer

You can try:

pgrep python | xargs kill