Wednesday 4 April 2018

How to kill processes run by a User on Linux


     If you are a DBA, there are situations where you want to kill all processes belonging to a specific user, for example because the user is being removed or the user is forking malicious processes. It will take long time to kill individual processes of the user one by one manually. In this post I will show you how to kill all the process IDs at a time launched by a user.
     Here I use a command that kills all the processes owned by Linux user say "applfprd".


      To generate the process IDs, we use ps command

$ ps -ef | grep applfprd | awk {'print $2'}

Now we have to kill the process IDs which are generated above

$ ps -ef | grep applfprd | awk {'print $2'} | xargs kill -9

                                          (or)

$ sudo pkill -u applfprd
             
                                          (or)

$ pgrep -u applfprd | sudo xargs kill -9

                                           (or) 

$ sudo killall -u applfprd




Posted by: Anil Bandi

 Oracle Apps DBA

No comments:

Post a Comment

Forgot WebLogic Password | Reset WebLogic Password

If you forgot / doesn't aware of Weblogic Console password. Want to Reset it?  1.   Shut down all running services .  Since the Adm...