Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Killing processes SHELL

This command ps -ef | grep php returns a list of processes

I want to kill in one command or with a shell script all those processes

Thanks

like image 369
geekInside Avatar asked Sep 16 '25 18:09

geekInside


1 Answers

The easiest way to kill all commands with a given name is to use killall:

killall php

Note, this only sends an interrupt signal. This should be enough if the processes are behaving. If they're not dying from that, you can forcibly kill them using

killall -9 php
like image 160
Sebastian Paaske Tørholm Avatar answered Sep 18 '25 10:09

Sebastian Paaske Tørholm