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
What is dot profile in unix?
Explain the importance of directories in a unix system
What is inode in unix operating system?
What is a parent directory in unix?
What is unix portability?
How do you delete a file in unix?
Is mac a unix?
What is pipe in unix example?
How to give execute permission for a file in unix?
What is called in unix?
Describe the responsibilities of shell in brief.
What is .profile unix?
How do I create a directory in unix?
How to remove the first line/header from a file in Unix?
What is the file in unix?