This question already has an answer here:

I was working normally and suddenly one program collapsed: it got unresponsive and its window went grey. After that it did appear this message asking what to do: close the program or wait for it to respond.

I selected close the program, but it didn't worked as intended: the whole ubuntu did freeze up and I couldn't do anything.

I realize then that typing Ctrl + Alt + t I could open the terminal, and it did worked: it opened the terminal. But I didn't know what to do next.

So my question is: What to do from the terminal if a program freezes up? In my case it was nautilus (I was connecting to a remote server, using it as an FTP program) and I ended up rebooting the machine with sudo reboot.

It sucks. It would have been far better to close the unresponsive program, but how may I do that? And what if I don't know the unresponsive program's name?

FYI, I've read this topic "UI elements become completely unresponsive" and I don't think it's the same case here, because I don't normally have this issue, it's sometwhat uncommon, and the memory is working fine, and the machine is a pretty new one (intel Core i7, 8 Gb ram).

marked as duplicate by Braiam, Eliah Kagan, muru, Seth Oct 21 '14 at 19:43

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


You can do xkill. This nifty little utility automatically mauls the next window you click.

Another option you can use is something called top or htop. Look for a weird process, especially something marked as a "zombie" or taking up lots of system resources. You can then kill it using the K key. Use kill code 9, as that causes an instant and forced kill of the process.

Say the bad program is nautilus. Use one of these methods:

  1. Use xkill in the terminal and click on the Nautilus window. X will terminate its session, causing Nautilus to crash. Spam the ESC key for a few seconds to make sure Xkill stll isn't running.
  2. killall -9 nautilus
  3. Run top, look for nautilus, and kill it from top.

Note that you might need to use sudo privileges to kill some processes.

  • I've tried it and it works (thanks! it's pretty easy to use) ... BUT.... after I kill the window and wait for the terminal to let me type again, I type "exit" and the terminal window freezes up... :s – Rosamunda Oct 20 '14 at 19:14
  • @Rosamunda That is a problem with Xorg/Unity/Something itself then. – Kaz Wolfe Oct 20 '14 at 19:16

One of the big advantages of a terminal based system we have is that the answer is a sounding YES.

What I normally do is switch to terminal 1 (your desktop is always in terminal 7) with control-alt-f1.

If you know what the program is this is going to be pretty easy: find the process ID of that task and kill it. The task will disappear on terminal 7 and if this fixed the crash your system will respond again.

Example using firefox: when you start firefox it gets a process ID and you can view these with ps -ef | grep firefox. Replace firefox with whatever you want to search.

ps -ef |grep firefox
rinzwind  5046  1484 48 19:52 ?        00:00:01 /usr/lib/firefox/firefox
rinzwind  5113  4992  0 19:52 pts/4    00:00:00 grep --color=auto firefox

(the process referring to the grep is my command)

The 1st number behing my login name is the process ID. kill -9 5046 will kill firefox:

~$ kill -9 5046
~$ ps -ef |grep firefox
rinzwind  5148  4992  0 19:54 pts/4    00:00:00 grep --color=auto firefox

and firefox is gone on my desktop.

The problem normally is to identify the correct process ID: when you have 5 firefox sessions open...getting the correct one will be a bit of a problem. Then you might need to add in some more logic to narrow it down.

Warning: use common sense. Killing the lower process IDs (under 500) should be avoided.

Not the answer you're looking for? Browse other questions tagged or ask your own question.