24

Does Linux have a CTRL+ALT+DEL equivalent?

2
  • 4
    CTRL+ALT+DEL can do many things on Windows? Are you looking for a process manager?
    – Pylsa
    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
23

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
  • 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
10

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 :)

3
  • 5
    make: *** No rule to make target `me'. Stop.
    – Eroen
    Mar 30 '12 at 15:47
  • 2
    @Eroen /usb/bin/sudo file not found. Feb 1 '20 at 22:17
  • 1
    SystemV-style init is not used by most distributions anymore. Feb 16 at 9:20
8

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.

3
  • 2
    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 '19 at 17:02
  • Edited the answer, hope this clarifies the confusion.
    – Thomas
    Mar 25 '19 at 11:13
  • Whether REISUB works, depends on the contents of file /proc/sys/kernel/sysrq. It may be disabled altogether, or some functionalities may be disabled. For example, I had some machine where Ubuntu MATE 18.04 was often freezeing, and it turned out that in the default configuration of that system only B of the REISUB actually worked.
    – raj
    May 14 at 10:06
4

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.

On Ubuntu 20.10 for example, which uses systemd as the init, everything is wired up so that Ctrl + Alt + Del by default offers to log you out on the GUI. How can I give a grace period to CTRL-ALT-DEL in systemd suggests that this is controlled by /lib/systemd/system/ctrl-alt-del.target, but on my system that is just a symlink to reboot.target, which seems to actually reboot, not just logout. Maybe someone more patient than me can figure out exactly what is going on.

1
  • 1
    This is the answer I came here for, thank you so much! <3
    – troglobit
    May 14 at 8:12
3

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.

3

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).

1
  • 2
    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 '19 at 10:59
2

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.

2
  • +1 for magic SysRq-keys. They have been handy many times in the past. Mar 30 '12 at 17:50
  • Whether REISUB works, depends on the contents of file /proc/sys/kernel/sysrq. It may be disabled altogether, or some functionalities may be disabled.
    – raj
    May 14 at 10:07
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.

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

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.