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 to know the information about a file?
Explain about the directory representation in UNIX?
How many root directories exist in unix?
What is unix used for?
How do I show only directories in unix?
What is unix kernel explain it?
How do we change file access permissions?
Explain links and symbolic links.
Explain the importance of directories in a unix system
Does mac use unix?
Is unix a coding language?
What is a filter in unix? Give an example.
What are the four components of the unix file system?
How to install unix on windows 10?
What scheme does the Kernel in Unix System V follow while choosing a swap device among the multiple swap devices?