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?

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


Please Help Members By Posting Answers For Below Questions

How do you make programs portable on unix and dos under such circumstances?

993


How to change the directory in unix?

986


How would you display the last line of a file?

907


How to check logs in unix?

995


How do I find a pattern in unix?

927


Who owns the unix trademark today?

899


What does the swapping system do if it identifies the illegal page for swapping?

1047


In unix, what is echo used for?

1012


What is buffer header unix?

862


Name the data structure used to maintain file identification?

979


What are the advantages of unix operating system?

950


How do I get to my home directory in unix?

939


If we are terminated at the middle of the program execution in UNIX,what will happen to the program, it will continue running r terminate r the o/p will be send to your mail?

1413


Differentiate between paging and swapping?

898


What are the phases of swapping a page from the memory?

935