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 know the information about a file?

1035


Explain about the directory representation in UNIX?

1011


How many root directories exist in unix?

1061


What is unix used for?

1014


How do I show only directories in unix?

1118


What is unix kernel explain it?

982


How do we change file access permissions?

1184


Explain links and symbolic links.

1003


Explain the importance of directories in a unix system

1105


Does mac use unix?

993


Is unix a coding language?

930


What is a filter in unix? Give an example.

970


What are the four components of the unix file system?

963


How to install unix on windows 10?

1068


What scheme does the Kernel in Unix System V follow while choosing a swap device among the multiple swap devices?

1106