Kill all processes belonging to one user

Hi,

Is there a way to kill all processes belonging to one user in one shot?

Thanks,
Narayan

Hi,

on AIX, become this user and issue

kill -9 -1

... that kills everything owned by the user - including his shell.

Don't do it as root and be very very careful as dba !!!!!

Kind regards
zxmaus

1 Like

Thanks for the reply.But is it possible that I can get the output and run it?As I'm working as a dba this may not be always feasible.

well you should first check which processes the user runs ...

ps -aux | grep {user} 

and if you're happy to kill all of them,

kill `ps -aux | grep {user} | awk '{print $2}'`

or the harder way (for what is left after the graceful kill)

kill -9 `ps -aux | grep {user} | awk '{print $2}'`

on Linux a

pkill -u <user>

should work, too.

If you find that you rather don't want to kill all userprocesses, there is not much left than killing just the list of processes, you want to get rid of.

Kind regards
zxmaus

1 Like

Thanks a lot.

Regards,
Narayan