Sunday, 8 June 2008

Closing applications that have hung - part 2

In my previous post, there were some things I missed out, which I'll now fill you in on. First of all, if something has hung, it can be a pain to try and launch a terminal just to close something down, but you don't need to. Just press Alt+F2 in Ubuntu to get the Run dialog and enter xkill there.

But what about if the entire screen has hung and it's too slow to do anything? Well, there's several options here. You can press Ctrl+Alt+Backspace to restart your X window server, but that's overkill. A better idea is to press Ctrl+Alt+F2 to take you to a virtual terminal. You can log in by entering your username, then you'll be prompted for your password. Once you've logged in, enter the following command:

This displays a list of the running applications. It includes details of how much memory and CPU each is using. Look for the application you want to stop, and note the PID (process ID) number. Then press Q to exit top.

Now you know this number, it's easy to kill the process from the command line. If this number was 1234 for the program you wanted to stop, you'd enter the following:
kill 1234

Easy! Now press Ctrl+Alt+F7 and you'll be back at your desktop as usual, minus the hung application.

No comments: