Categories: ITLearn

kill all processes used by a specific application or user

Shell script to kill all processes used by a specific application or user

On Linux servers, when applications are not correctly shut down, there are still some processes running and starting the application with those processes still running can result in the application not starting correctly or not functioning properly. It is imperative to always kill all lingering processes after shutting down an application.

If the list of  the lingering processes is long, it can be a pain to go through them one by one.

This shell script will kill them all in one command.

#!/bin/sh
#NOTE: Please don’t try this unless you have tried every thing else and there is no way else left.
# Run it as root
# For this example, you are running a oracle application using user account oracle.
# We assume that , there are not other application running under the account oracle.
kill -9 `ps -ef | grep oracle  | grep -v grep | awk ‘{print $2}’`
Etienne Noumen

Sports Lover, Linux guru, Engineer, Entrepreneur & Family Man.

Recent Posts

The Importance of Giving Constructive Feedback

Offering employees, coworkers, teammates, and students constructive feedback is a vital part of growth on…

2 days ago

Why Millennials Need To Invest for Retirement Now

Millennials should avoid delaying the inevitable and look into various retirement investment pathways. Here’s why…

2 days ago

A Daily Chronicle of AI Innovations in May 2024

AI Innovations in May 2024

6 days ago

Tips for Ensuring Success Throughout Your Career

For most people, a satisfactory career is essential for leading a happy life. However, ensuring…

1 week ago

Different Career Paths in the Pipeline Industry

The pipeline industry is more than pipework and construction, and we explore those details in…

1 week ago

SQL Interview Questions and Answers

SQL Interview Questions and Answers In the world of data-driven decision-making, SQL (Structured Query Language)…

2 weeks ago