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
How do you make programs portable on unix and dos under such circumstances?
How to change the directory in unix?
How would you display the last line of a file?
How to check logs in unix?
How do I find a pattern in unix?
Who owns the unix trademark today?
What does the swapping system do if it identifies the illegal page for swapping?
In unix, what is echo used for?
What is buffer header unix?
Name the data structure used to maintain file identification?
What are the advantages of unix operating system?
How do I get to my home directory in unix?
If we are terminated at the middle of the program execution in UNIX,what will happen to the program, it will continue running r terminate r the o/p will be send to your mail?
Differentiate between paging and swapping?
What are the phases of swapping a page from the memory?