Report inadequate content

Kill processes using string search

{
}

 -

A lot of Linux distributions (and Mac) come with a handy command named pkill installed by default. This command is very useful to kill processes in a more natural way.

Instead of doing a kill/killall based on the ID of the process or the binary name, you can just pass a string that appears in any part of the process list, including the parameters you used to start a service.

To kill the process you only have to type pkill yourstring.

Example:

$ ps -aux
root 32495 1 0 Sep24 ? 00:09:42 /bin/bash /root/deploy.sh
root 31054 1 0 Sep24 ? 00:09:44 /bin/bash /root/deploy.sh
# Kill both bash processes:
pkill deploy

 

{
}
{
}

Leave your comment Kill processes using string search

Log in to Obolog, or create your free blog if you are not registered yet.

User avatar Your name