Operating System - HP-UX
1835065 Members
2156 Online
110073 Solutions
New Discussion

Re: How to kill all processes started by a particular user

 
B V B Kumar
Frequent Advisor

How to kill all processes started by a particular user

Hi all,

Can anybody tell how to kill all processes started by a user.

regards
6 REPLIES 6
Dennis Handly
Acclaimed Contributor

Re: How to kill all processes started by a particular user

On 11.31, you can use pkill(1).
Otherwise you would need to use:
echo kill $(UNIX95= ps -fu user -opid=)

Remove that echo if you are happy it is doing what you want.
Avinash20
Honored Contributor

Re: How to kill all processes started by a particular user

Refer to
http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1182794
"Light travels faster than sound. That's why some people appear bright until you hear them speak."
Ernesto Cappello
Trusted Contributor

Re: How to kill all processes started by a particular user

Hi BVB, i have to follow these steps:

1) su - ... (as root .. for example su - cappello)

2) kill -9 -1

Best regards.
Ernesto


Rasheed Tamton
Honored Contributor

Re: How to kill all processes started by a particular user

Hi,

I would try to explain a bit more:

ps -fu kumar

then you will get processes owned by kumar
Check which process you want to kill by looking the command column and note the PID of it.

kill PID

if PID is 2979
kill 2979

if it does not get killed

kill -9 2979

regards.
Ernesto Cappello
Trusted Contributor

Re: How to kill all processes started by a particular user

Hi BVB, to be more precise and explain better, you have two ways:

================================
To kill "ALL" processes
================================
a) su - (as root ... for example su - cappello)

2) kill -9 -1



================================
To kill one process
================================
1) ps -fu (dor example ps -fu cappello)

check which process you want to kill and remember his PID (looking PID column - PID=ProcessID).

2) kill -9 PID (as root ... for example kill -9 1000)


Best regards.
Ernesto
James R. Ferguson
Acclaimed Contributor

Re: How to kill all processes started by a particular user

Hi:

Only as a last resort should you use 'kill -9'. To terminate a process begin with:

# kill -1 (known as kill -hup)
# kill -2 (known as kill -int)
# kill -15 (known as kill -term; the default)
# kill -9 (a last resort!)

The first three signals can be trapped by a program. This allows a process to ignore them or to perform some sort of handling like removing temporary files and shared memory segments before exiting.

A 'kill -9' cannot be caught (ignored or handled) by a process and thus there is NO chance for the process to cleanup resources it may have requisitioned.

Be aware that if a 'kill -9' does not eliminate a process it means that the process is waiting on an event (often an I/O). Until the event happens, the process can run again and therefore isn't responsive.

Regards!

...JRF...