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 it possible to create new a file system in UNIX?
Which data structure is used to maintain the file identification?
What do you understand by the term wild-card interpretation?
Explain kernal and shell?
In what way the protection fault handler concludes?
How to reverse a string in Unix?
What are the phases of swapping a page from the memory?
How does unix file system work?
How to get the n-th field from a Unix command output?
How old is unix?
How to find out what processes are running in the background in unix?
How do I remove 30 days old files in unix?
How do you switch from any user type to a super user type?
How do I delete files older than 2 days unix?
How to check the date in unix?