Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
Operating System - Tru64 Unix
cancel
Showing results for 
Search instead for 
Did you mean: 

Kill old processes

SOLVED
Go to solution
RJA
Advisor

Kill old processes

I have a number of process that I need to kill. They all have a common string in the process name (the keyword "check" in this case). Is there a way to do this without a separate kill command for each process? I am not familiar with Tru64. Thanks.
3 REPLIES
Victor Semaska_3
Esteemed Contributor
Solution

Re: Kill old processes

RJA,

This should work:

ps -eo pid,cmd | grep check | grep -v grep | awk '{print $1}' | xargs kill

But proceed with caution, in other words, use at your own risk. Any other processes with 'check' in it will be terminated as well.

Vic
There are 10 kinds of people, one that understands binary and one that doesn't.
Ivan Ferreira
Honored Contributor

Re: Kill old processes

It would be good if you post a sample ps output, to avoid posting commands that may kill process that you don't want to kill.

A sample command could be like this:

kill `ps auxw |grep check |awk '{print $2}'`

You can create an alias in your .profile, for example:

alias killcheck="kill `ps auxw |grep check |awk '{print $2}'`"

Then all you have to do is to run the killcheck command.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
RJA
Advisor

Re: Kill old processes

thanks !