Sunday, 18 March 2007

How to Manually Force a Program to Close

Yes, programs in Linux can crash.

If you need to force a program to close, but are wondering what the heck Kubuntu folks use instead of Task Manager (CTRL-ALT-DEL), try using the terminal instead.

(I suspect there is a GUI like Task Manager kicking around somewhere that you can install, but that would require installing it or finding it. You already have a terminal).

What you need to do is find the Process ID of the program that is running, and then kill that process. First: open a Konsole window. In the window, type
ps -e | grep NameOfProgramYouWantToKill
or
ps aux | grep NameOfProgramYouWantToKill
Sometimes the name of the program not obvious or not what you expect it to be. In that case, you can just do
ps -e
or
ps aux
and scroll through the list to find it. Once you find it, you'll notice a number beside it, on the left. Type:
kill number
And hopefully you've shut the right program down. The program should disappear from the taskbar. As always, if you are consistently starting to experience problems with hanging programs, you should try rebooting the computer. If you still experience problems, Google for bugs or an update or patch for the software.

1 comment:

Anonymous said...

What happens when kill doesn't work? Usually when I have a program freeze and not want to close the normal way, kill never works. killall doesn't either.

Now what?