DEV Community

Diego Carrasco Gubernatis
Diego Carrasco Gubernatis

Posted on • Originally published at diegocarrasco.com on

How to find all processes with a specific string in their name and kill them all (in linux command line using ps, grep and awk)

Context

You want to find all the processes of, for example, visual studio code, and kill them all for the command line in linux.

To find all the processes ids for a particular app you can use the following:

Find all the processes for a particular app

ps -d | grep app_name | awk '{print $1}'

For example to find all the processes for visual studio code (process name is code, you would type

ps -d | grep code | awk '{print $1}'

Kill all the processes for that particular app

If you want to kill all those processes, just prepend kill and use the ids as arguments

kill $(ps -d | grep code | awk '{print $1}')

References

Speedy emails, satisfied customers

Postmark Image

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay