lokesh


{ City } bangalore
< Country > india
* Profession * se
User No # 114125
Total Questions Posted # 5
Total Answers Posted # 3

Total Answers Posted for My Questions # 9
Total Views for My Questions # 27500

Users Marked my Answers as Correct # 1
Users Marked my Answers as Wrong # 1
Questions / { lokesh }
Questions Answers Category Views Company eMail

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

Subex,

1 Unix General 2926

write a query that displays every Friday in a year with date?

Flipkart, HCL, TCS,

5 Oracle General 4780

Write a shell script to check whether a number is Armstrong number or not?

Flipkart,

1 Shell Script 15433

How will you schedule a job that will run every month last day?(some months have 30 days,some 31 days,28,29 days)

NTT Data, TCS,

1 Shell Script 2656

what are command line arguments? what is the need of those?

Flipkart,

1 Shell Script 1705




Answers / { lokesh }

Question { Patni, 24991 }

in unix echo is used for


Answer

It is just like printf in C language.

Is This Answer Correct ?    0 Yes 1 No

Question { 8202 }

which command is used to change group?


Answer

U can use chown also,
chown user:group_that_owner_to_be_changed file_name

Is This Answer Correct ?    0 Yes 0 No


Question { Subex, 2926 }

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


Answer

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