Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


A process is running for 1000 times.How to kill all processes except one i.e kill 999 processes?



A process is running for 1000 times.How to kill all processes except one i.e kill 999 processes?..

Answer / 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

More Unix General Interview Questions

Differentiate between paging and swapping?

0 Answers  


In what way the Fault Handlers and the Interrupt handlers are different?

0 Answers  


What is af_unix?

0 Answers  


Is it possible to create new a file system in UNIX?

0 Answers  


What are the general Commands in using Unix OS for a beginner? how many commands you know in that?

2 Answers  


What is unix operating system?

0 Answers  


What is alias mechanism?

0 Answers  


How to give execute permission for a file in unix?

0 Answers  


1)what is grep|sort give example? 2)what are the test commands

1 Answers   Cap Gemini,


Does windows use unix?

0 Answers  


What is hardlink and softlink in unix?

0 Answers  


Why was unix created?

0 Answers  


Categories