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
Is mac unix like?
How do I grep recursively in unix?
What are internal and external commands in unix?
How to find a file in unix?
What is the ‘nohup’ in unix?
What is unix directory structure?
What does shebang mean in unix?
Define a process group.
What is process termination in unix?
How do we change file access permissions?
In unix, what is echo used for?
What is Thread dump in unix?
What is hardlink and softlink in unix?
How many types of files are there in unix?
How to know the information about a file?