141

On Windows anytime the system hangs Ctrl-Alt-Del brings up the Start Up Manager, from which you can end the program or process causing the hang.

Is there any command like this on Ubuntu?

BuZZ-dEE
  • 14,223
Mysterio
  • 12,018

8 Answers8

125

System Monitor shows you an overview of running applications (under the Processes tab) and allows you to end them by right-clicking on the name and selecting the respective context menu item. You can set up keyboard shortcuts in the Keyboard settings (Shortcuts tab), so you can bind Ctrl+Alt+Del to gnome-system-monitor, the command to start System Monitor.

Another command you might be interested in is xkill. This is traditionally bound to Ctrl+Alt+Esc (not sure if by default) and allows you to click on a misbehaving window to close it.

Both of these might not work if your entire system hangs. If that happens, there are two things you can do. The first has to be enabled in advance when your system doesn't hang yet (you could do it right now): open Keyboard Layout settings (I believe this is merged into Keyboard in Ubuntu 12.04), then click Options. One of the options is Key sequence to kill the X server, you can click that run gsettings get org.gnome.desktop.input-sources xkb-options for recent versions of Ubuntu (according to this answer). If you have done that and your system later hangs, you can press Ctrl+Alt+Backspace, which will effectively bring you back to the login screen.

If even that doesn't work, the last thing you can do is ensuring a sane shutdown (i.e. not pressing and holding the power button). This one is a bit hard to remember, but it involves pressing and holding Alt+SysRq (system request, often same key as PrtScr print screen) and then while holding those two keys press one at a time in order R, E, I, S, U, B (a mnemonic is Reboot Even If System Utterly Broken, but may also be easily remembered as "BUSIER" backwards). Wait a second between each press, because each letter is a different kernel action leading to a "graceful" reset.

ethan
  • 314
Vincent
  • 2,228
  • 3
    How do I know what is causing the system hang? In windows, task manager shows which application is NOT RESPONDING from which the user can end the process controlling the application in question – Mysterio Jan 13 '12 at 18:04
  • 1
    Oh, usually for me the windows of an application that no longer responds becomes a lot darker. You can enable this in CompizConfig Settings Manager (you might need to install this, the package name is ccsm). Click the Fading Windows plugin, and there you can check "Dim Unresponsive Windows". Then in the future you should know which window to kill. – Vincent Jan 14 '12 at 13:38
  • 1
    Just a note -- Ctrl-Shift-Esc is a bit slower since the system doesn't handle it specially. If there's something wrong with the OS, then this combo might not work. – user541686 Jan 14 '12 at 15:23
  • 15
    Another way to remember it is that REISUB is BUSIER backwards. – DNA Oct 14 '12 at 21:53
  • I didn't know this ALT+PRTSC+REISUB combination. However, on my Swiss German keyboard I would have to use the nose or tongue to hit the R,E,I,S,U,B keys so it mustn't be used very often :-) – Marc Jan 15 '15 at 13:17
  • On Ubuntu 17.10, ALT+F4 is the default to close a window – James Ray Mar 19 '18 at 23:14
  • The command gsettings get org.gnome.desktop.input-sources xkb-options shows the current setting - it doesn't change anything. Read the linked answer for how to enable Ctrl+Alt+Backspace. – AdamS Oct 31 '21 at 11:35
  • @Marc just to clarify I believe you only hold down Alt + Sys Rq, then while holding them down you press R then E then I then S then U then B in that order. You don't press REISUB all at once. – ethan Mar 31 '22 at 19:35
35

To stay in the spirit of magical shortcuts, here are some :

  • ctrl+alt+backspace combination (disabled on default on 11.10) that can restart the GUI.
  • ctrl+alt+F2 to F6, that will display a console from which you could login and then eventually kill the stucked application. Once you killed it you can return to the GUI by pressing alt-f7. Killing an application by name can be done by using this command:

    sudo killall <name-of-the-application>
    

    If this doesn't work, use the -9 flag to kill it with überforce.

    sudo killall -9 <name-of-the-application>
    
  • IN CASE OF EMERGENCY : use the Magic SysReq Key to directly "speak" to the kernel.
  • 6
    +1 sysrq. why noone mentions ctrl+printscreen+K, that will restart the GUI *and kill all processes in the gui* (in case you didn't expect that from a restart). sysrq is the same key as printscreen key. – n611x007 Jul 09 '13 at 00:33
  • 3
    Ctrl+alt+F2 magically f'ed my day up. Thx – Nick Pineda Jan 10 '16 at 05:49
  • "you can bind Ctrl+Alt+Del to gnome-system-monitor" It's actually still working in April 2019 with Lubuntu Desktop 18.4. – Miracles Happen Apr 04 '19 at 06:05
  • 1
    I accidentally put an infinite loop in my /etc/profile and I was just getting a black screen on boot. And ctrl+alt+F-something brought up the console for me to cancel! Thanks! – ProGrammar Jul 29 '19 at 00:42
8

you could have a short command for opening a terminal, I have F4. When you need to force an application to quit just open a terminal and type xkill and then click in the window of the application that has crashed.

GNOME-shell

  1. System --> Preferences --> keyboard shortcuts (gnome-keybinding-properties)
  2. go down to the Desktop list, click on Run a terminal then hold your short command.

    the short command should be visible in the line on the right.

To kill a process

  1. Open a terminal. (Or just use Alt+F2.)
  2. Type: xkill
  3. Click in the window that has crashed.

Having a short command for opening a terminal is a good idea in general because you can do other things as well. (htop, system monitor, rebooting, etc.)

Eliah Kagan
  • 117,780
Alvar
  • 17,058
  • Could you update your answer with steps needed to create the F4 shortcut to open the terminal – Mysterio Jan 14 '12 at 14:26
  • 1
    @Mysterio Right not I can only make a GNOME-shell (classic desktop) version I will make one with Unity later. (tomorrow) also what system are you using? (11.10? Unity?) – Alvar Jan 14 '12 at 14:28
  • Unity is my preferred desktop – Mysterio Jan 14 '12 at 18:15
  • 1
    By default, Ctrl+Alt+T opens a terminal. – Scott Severance Jan 20 '12 at 17:09
  • @scottSeverance No it doesn't, not on my 11.04 at least... still having a known shortcut for a Terminal is really key when Using any Linux distributions. – Alvar Jan 20 '12 at 21:35
  • I don't remember whether I used that shortcut on 11.04. I learned it more recently, but I know that even in the live environments of Ubuntu and Lubuntu 11.10, it works by default; it also works in both of my machines, one of which has been upgraded from about 8.04 to 11.10 and every version in between. – Scott Severance Jan 21 '12 at 04:49
5

System-monitor is what your looking for. You can launch it by typing system-monitor in the Unity Dash.

Jorge Castro
  • 71,754
balloons
  • 1,509
3

On Ubuntu 17.10 with GNOME, ALT+F4 is the default to close a window. As per this answer, after setting CTRL+ALT+Backspace to gsettings get org.gnome.desktop.input-sources xkb-options, with the Brave browser open it just pulls down or up the menu toolbar, while with other applications it does nothing. CTRL+ALT+DEL will bring you back to the default screen after 60 s, at least if the system hasn't hung, and will pop up a window prompting to cancel or confirm log out. CTRL+ALT+ESC does nothing by default.

So if you want to bind opening the system monitor, either change the shortcut binding for log out to something else, or use another shortcut.

This is how to set a shortcut for xkill.

enter image description here

You can open this window by searching for keyboard shortcuts in activities. I've used CTRL+Suoer+ESC since CTRL+ALT+ESC is taken for switching the system controls directly (which toggles the menu toolbar in Brave, but in the terminal it doesn't seem to do anything).

For gnome-system-monitor, I've chosen to bind it to CTRL+ALT+DEL, after changing the default/built-in log out shortcut from CTRL+ALT+DEL to CTRL+ALT+L.

James Ray
  • 393
3

You can add a custom keyboard command using the following steps:

  1. Go to System Settings
  2. Click Keyboard
  3. Open the Shortcuts tab
  4. Click the "+" symbol near the bottom of the window
  5. Give your command a title. E.g. System Monitor
  6. In the Command field, enter gnome-system-monitor
  7. Click Apply
  8. Click Disabled on your newly created shortcut
  9. Enter the key combination you want for your shortcut. E.g. Ctrl+Alt+M

Note: on Ubuntu 14.10, Ctrl+Alt+Del is already in use, but can be overridden.

3

I had the same question. The answer I was looking for was: "type top on terminal"

With top you can see which processes are working on your Linux and decide which one has to be killed.

muru
  • 197,895
  • 55
  • 485
  • 740
2

It may not be relevant to your question but I found chrome in ubuntu has its own task manager. Press the Shift + ESC keys to open it.