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 to find out what processes are running in the background in unix?

927


Is unix still relevant?

937


List the distributions of unix.

914


Explain the different types of pathnames that are used in unix.

848


Is mac terminal unix?

861


How does unix work?

830


What is .sh file in unix?

952


Who is founder of unix?

1033


How do I find my unix os version?

906


What is unix directory structure?

899


What is unix shell scripting used for?

881


Explain system bootup in unix.

917


What is the procedure to configure MC/SG Cluster services in HP-UX 11i v3 OS Environment?

5863


Why do we need unix shell scripting?

932


What is awk sed unix?

888