18

Does Linux have a CTRL+ALT+DEL equivalent?

migrated from stackoverflow.com Sep 28 '10 at 13:57

This question came from our site for professional and enthusiast programmers.

  • 3
    CTRL+ALT+DEL can do many things on Windows? Are you looking for a process manager? – BloodPhilia Sep 28 '10 at 14:00
  • This varies a great deal by what kind of system you are using. What distribution/desktop environment/window manager do you use? – Daenyth Sep 28 '10 at 14:19
17

X can be killed using Ctrl+Alt+BackSpace, and if you hit Ctrl+Alt+F1 (or F2 through 6), you'll be dropped to a virtual console where you can type commands to kill the bad app. To switch back to the GUI, hit Ctrl+Alt+F7.

  • 1
    Might need to hit Alt+SysRq+R before you can use Ctrl+Alt+F1, if the keyboard is stuck in some strange mode. – Eroen Mar 30 '12 at 15:44
9

Under GNU/Linux [at least those based on the SystemV init style], the behavior of ctrl+alt+del relies on the configuration file /etc/inittab where you should be able to read a line like:

<id>::ctrlaltdel:/sbin/shutdown -t3 -r now

(example from an ArchLinux distribution) which means that the system will be shutdown when it receives the key combination. But you may want to do something else, like*:

<id>::ctrlaltdel:/usb/bin/sudo make me a sandwich

(which is much more useful :)

  • 4
    make: *** No rule to make target `me'. Stop. – Eroen Mar 30 '12 at 15:47
7

Well you can create shortcut for Alt+Ctrl+Del in Linux, but there is some other more interesting combinations that you might like to know.

Holding down Alt and SysRq (which is the Print Screen key) and typing REISUB with a few(I usually count to 5) seconds between each key will get you safely restarted. REISUO will do a shutdown rather than a restart. As pointed out by a comment, this is not a single command, but a combination of many commands, each doing a specific thing. So I recommend to take a look at REISUB - the gentle Linux restart for more details.

And you might already know this but press Alt + Ctrl + any of the keys from F1 to F6 to get a console at any time, which you can use to login in text mode and use command line. This was very helpful when I messed my desktop environment.

  • 1
    Downvoted. Define "slowly", or explain what reisub really does. This is not a single command, but a combination of 6 commands, each of them doing something specific (look up the Wikipedia article on magic SysRq key for details). So if you hit i too quickly after e, you can kill the programs while they're still shutting down - like I did after reading this answer. – Przemek D Mar 22 at 17:02
  • Edited the answer, hope this clarifies the confusion. – Thomas Mar 25 at 11:13
2

Yes, however the action it takes depends on desktop manager configurations. In KDE it shows a dialog for which you can choose if restart or halt the system.

2

In the Linux console, by default in most distributions, Ctrl+Alt+Del behaves as in the MS-DOS - it restarts the system.

In the GUI, Ctrl+Alt+Backspace will kill the current X server and start a new one, thus behaving like the SAK sequence in Windows (Ctrl+Alt+Del).

  • The second part is simply false. Killing the X server will immediately terminate the active session, and all active programs with it. This is nowhere near what ctrl+alt+del does in Windows. – Przemek D Mar 25 at 10:59
1

REISUB would be the closest equivalent. Magic SysRq keys are the only way of emulating traditional Windows / DOS hard-resets in Linux / UNIX.

For a Program Manager-like interface, use top and hit 'k' for 'k'ill.

Ctrl+Alt+Backspace is disabled by default in X Servers > 1.6 (although some distros re-enable it in the config files that they ship). Although it doesn't do what Windows Ctrl+Alt+Del does in general killing X and fixing misbehaving programs is preferred over restarting the machine.

  • +1 for magic SysRq-keys. They have been handy many times in the past. – Daniel Andersson Mar 30 '12 at 17:50
0

In gnome, there's a feature called "Keyboard Shortcuts" that lets you customize keyboard shortcuts.

The process manager for Gnome is called gnome-system-monitor, so if you go to: - System; - Preferences; - Keyboard Shortcuts and add gnome-system-monitor as CTRL+ALT+DEL it should work for you :)

0

Yes, they are the same keys as on Ubuntu but they may vary according to your distribution.

  • That's not true. This will mostly reboot the window manager, not open up a task manager. – slhck Jul 18 '12 at 0:50
0

The Linux kernel can either hard reboot or send SIGINT the init process upon Ctrl + Alt + Del

Therefore, if the SIGINT behaviour is enabled, then you can make Ctrl + Alt + Del do whatever your init wants it to do.

The Linux kernel itself allows two possible behaviors from Ctrl+Alt+Del:

  • reboot immediately
  • send SIGINT to the init process

Which behavior is used can be selected with either:

  • reboot system call, see man 2 reboot
  • /proc/sys/kernel/ctrl-alt-del

For example, BusyBox' 1.28.3 init execs an arbitrary command given in /etc/inittab as:

::ctrlaltdel:/sbin/reboot

And here is a minimal interesting C example for uclibc:

#define _XOPEN_SOURCE 700
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/reboot.h>
#include <unistd.h>

void signal_handler(int sig) {
    write(STDOUT_FILENO, "cad\n", 4);
    signal(sig, signal_handler);
}

int main(void) {
    int i = 0;
    /* Disable the forced reboot, enable sending SIGINT to init. */
    reboot(RB_DISABLE_CAD);
    signal(SIGINT, signal_handler);
    while (1) {
        sleep(1);
        printf("%d\n", i);
        i++;
    }
    return EXIT_SUCCESS;
}

Here is an easy setup to try this out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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