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

Why kernel is known as the heart of unix os?

994


How to get the nth word of a line in Unix?

1050


How the Kernel handles the copy on write bit of a page, when the bit is set?

934


Is windows built on unix?

1024


What is grep family in unix?

937


What is unix orphan process?

1009


Name two paging states for a page in memory?

1064


What is meant by unix operating system?

943


What are the various ids in unix processes?

917


Explain what is a fifo?

1008


Explain about shell aritmetic operators and functions?

1021


What Happens when you execute a program?

1108


What is the ‘nohup’ in unix?

925


Is unix written in c?

799


How to get the last word from a line in Unix file?

959