A process is running for 1000 times.How to kill all processes except one i.e kill 999 processes?
Answer Posted / lokesh210
I think it will work.
U can kill all the process except one as below,
set a=`ps -ef|grep -c "XYZ"`
ps -ef|grep "XYZ"|head -`expr $a - 1`|xargs kill -9
To kill all the instances of that process
ps -ef|grep "XYZ"|xargs kill -9
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Why kernel is known as the heart of unix os?
How to get the nth word of a line in Unix?
How the Kernel handles the copy on write bit of a page, when the bit is set?
Is windows built on unix?
What is grep family in unix?
What is unix orphan process?
Name two paging states for a page in memory?
What is meant by unix operating system?
What are the various ids in unix processes?
Explain what is a fifo?
Explain about shell aritmetic operators and functions?
What Happens when you execute a program?
What is the ‘nohup’ in unix?
Is unix written in c?
How to get the last word from a line in Unix file?