Does Linux have a CTRL+ALT+DEL equivalent?
9 Answers
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.
-
1Might need to hit Alt+SysRq+R before you can use Ctrl+Alt+F1, if the keyboard is stuck in some strange mode.– EroenMar 30, 2012 at 15:44
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.
-
2Downvoted. 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 hiti
too quickly aftere
, you can kill the programs while they're still shutting down - like I did after reading this answer. Mar 22, 2019 at 17:02 -
-
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.– rajMay 14, 2021 at 10:06 -
To follow on from @raj — In Ubuntu (and therefore derivatives), for example, all but the
B
have been disabled. I don't know why, though. Jul 27, 2022 at 9:06
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 :)
-
5
-
2
-
1SystemV-style init is not used by most distributions anymore. Feb 16, 2021 at 9:20
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, seeman 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
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.
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).
-
3The 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. Mar 25, 2019 at 10:59
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. Mar 30, 2012 at 17:50
-
1Whether REISUB works, depends on the contents of file
/proc/sys/kernel/sysrq
. It may be disabled altogether, or some functionalities may be disabled.– rajMay 14, 2021 at 10:07
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 :)
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.– slhckJul 18, 2012 at 0:50