Recipe 8.8. Killing User Processes the Easy, Fun Way

 < Day Day Up > 

8.8.1 Problem

You need to delete a user, but userdel reports that some of the user's processes are running. You sure would like single command to find and stop all of the user's processes.

8.8.2 Solution

Use the slay program:

# slay foober slay: -KILL is kicking foober's butt! slay: Whoa, I have the power supreme.

slay finds and kills all the user's processes at once, saving you the trouble of hunting them down and killing them yourself. slay has four modes: nice, normal, mean, and butthead. Mean mode kills any nonprivileged user who attempts to slay another user. Set your desired mode in /etc/slay_mode.

8.8.3 Discussion

The traditional method of finding processes belonging to a user is to use ps, as in:

$ ps U 1007

or:

$ ps U foober 3936 ?        S      0:00 xchat 3987 ?        S      0:00 /usr/lib/galeon-bin 4209 ?        S      0:00 kdeinit: kio_file file /tmp/ksocket-carla/klauncherkF21rc.slave-

You can then kill one by one:

# kill 3936 # kill 3987 # kill 4209

8.8.4 See Also

  • slay(1), kill(1)

     < Day Day Up > 


    Linux Cookbook
    Linux Cookbook
    ISBN: 0596006403
    EAN: 2147483647
    Year: 2004
    Pages: 434

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net