The meaning and command executed on Ctrl+Alt+Del in Linux

keyboard shortcutslogoutreboot

In my gnome GUI desktop of Ubuntu 12.04, Ctrl+Alt+Delete will log out instead of rebooting.

But I was told that

Switching to a text-based virtual console and pressing Ctrl+Alt+Delete
will reboot the machine. It will shut down cleanly and reboot, which
is much better than Alt+SysRq+REISUB.

So I wonder if the above two different meanings of Ctrl+Alt+Delete are right?

What commands Ctrl+Alt+Delete is binded to in these two cases?

Best Answer

Ctrl+Alt+Delete is actually a "magic" keystroke for the IBM PC-compatible hardware architecture that would call a BIOS reset.

Since this kind of thing is dangerous for a system like Linux the decision was made to hook those keystrokes and do something else instead. This is controlled by init and you can see what it does by looking in /etc/inittab.

On my Debian Squeeze system:

ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now

Windows NT later followed suit and turned Ctrl+Alt+Delete into the secure key entry mode*.

In the case of X, it is similarly hooking the keystrokes but it simply kills the display server (which will automatically respawn if you're using a display manager).

Some systems (perhaps all, I haven't tried in a while) you can still press Ctrl+Alt+Delete before the OS loads to trigger a BIOS reset.


*I'm not sure what they actually call it.