Killing my Software


Killing my software

Q: There is a window on my desktop that does not react. It does not even disappear when clicking the close-button.

This page started to wrap up a thread on the LBo mailinglist. We are not quite up to 50 ways to get rid of a program that would not behave, but the list is growing:


kill

ps ax | grep <prgname to get the PID of prgname. After that, we can kill <PID>. If that does not work, kill -9 <PID>


xkill

Start xkill (via terminal or your launcher) and click the window to kill. Powerfull. X11 only. Convenient.


killall

killall <prgname> or killall -9 <prgname> kills all the programs with that binary. Might not get the target since sometimes binaries are named differently than the application (OOo → soffice.bin and the like)


bash-script

It can even be put in a file called “actuallykill” (you can make the name shorter).

#bin/bash

ps aux | grep $1 | awk -F ' ' '{print $2}'| xargs kill

Make it executable and in your path. And then at the command line actuallykill keyword and it will kill all processes that contain keyword.


pgrep and pkill

From the manpage:

pgrep looks through the currently running processes and lists the

process IDs which matches the selection criteria to stdout. All the

criteria have to match. For example, "pgrep -u root sshd" will only

list the processes called sshd AND owned by root.  On the other hand,

"pgrep -u root,daemon" will list the processes owned by root OR daemon.

pkill will send the specified signal (by default SIGTERM) to each process

instead of listing them on stdout.

This is a nice replacement for constructions like

"kill `ps ax|grep 'foo'|grep -v 'grep'|awk '{print $1}'` "

I found it here.


No comments yet.

Leave a Reply

Comments links could be nofollow free.