Feed on
Posts
Comments

kill stubborn processes


if you’re having difficulty killing recalcitrant jobs or programs, try this short but sweet script. note that this will even work for the mac; just use the terminal.app. i find this to be even faster than the apple-option-esc shortcut.

#!/bin/sh

#end recalcitrant processes

ID=$1
kill -9 `ps ax | grep -i “$ID” | awk ‘{print $1}’`

if you save it something like “slay.sh”, use it like:

slay.sh name-of-program

(mad props go to CWigs for inspiring this script)


Bookmark and Share

if that was helpful ...

check out the other tips and tricks i've compiled on these pages. you might learn something else interesting!

One Response to “kill stubborn processes”

  1. on 15 Sep 2007 at 11:08 am D

    Note that -9 is a violent kill to processes. It does not allow them to properly clean up after themselves. It should only be used as a last ditch effort to kill a process.

    May want to consider making a script that uses somehow

    ps -U username
    then kill pid after matching the pid to the desired thing to kill….
    but maybe the grepping and all that does just this??? so maybe
    the caution is to try the command above with just kill and not the -9

Did I get this wrong? Let me know!

Trackback URI | Comments RSS

More blogs about http://desk.stinkpot.org:8080/tricks.