Kill multiple process single command – Linux

Its a bit tedious task to kill if there are multiple process with same name.

In general we will kill one process at a time by getting its process id or we need to write a small script to kill all process id’s at a time.

To solve this issue there is a command called pkill in Linux.

With pkill we can kill multiple process id’s at a time.

Here is example:

I have multiple processes running with name less, as shown below.

$ ps x | grep less


12682 pts/7 S+ 0:00 less t
12746 pts/8 S+ 0:00 less t
12811 pts/9 R+ 0:00 grep –color=auto less

One way is we can kill one pid at a time with kill.

To kill all process id’s with name less use following command:

$ pkill -f less

Be cautious whenever you are using pkill command, since the process names given here are case sensitive.
pkill internally uses pgrep to get process id’s.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s