Force kill the process by name Linux

Suppose that you need to force kill a process by name or parameters in Linux. You can do it using this bash command:

ps ax | grep "<your_app_name>" | awk '{print $1}' | xargs kill -9 $1

Let’s analyze this set of the commands:

  • Execute ps ax. This command will list the processes on the system.
  • Next, we find in this list those processes that have the text in their name or parameters using grep "text".
  • The command awk '{print $1}' will print only the first column of the processes pid.
  • Then xargs kill -9 $1 will forcefully stop all found processes using their pid.
Telegram channel

If you still have any questions, feel free to ask me in the comments under this article or write me at promark33@gmail.com.

If I saved your day, you can support me 🤝

Leave a Reply

Your email address will not be published. Required fields are marked *