The Magic SysRq key (Linux Magic System Request Key) is actually an emergency key combination embedded within the Linux kernel.
Linux developers included this feature specifically for the following reasons:
- When certain letters are pressed together with the
Alt + SysRq (Print Screen)key combination, special commands are sent to the kernel. - These commands are processed directly by the kernel, even if the system is completely frozen (for example, the graphical interface is not working, and the keyboard does not seem to respond).
- In other words, it is the operating system's backdoor control mechanism.
- To recover the system β Perform a safe shutdown/reboot on a crashed or unresponsive system.
- To minimize data loss β Synchronize disks (sync) and protect the file system.
- To debug β Obtain information from the system during kernel debugging.
- To maintain control even in the worst-case scenario β Even if the graphical interface fails or the shell freezes, the kernel still listens to these keys.
Performed by pressing Alt + SysRq (Print Screen key) + a key:
bβ Immediately restart the system (reboot)oβ Shut down the system (power off)sβ Synchronize disks (write data from RAM to disk)uβ Switch file systems to read-only mode (to prevent corruption)rβ Switch keyboard to βrawβ mode (independent control from X or graphical interface)eβ Send a βterminateβ signal to all processesiβ Send a βkillβ signal to all processeskβ Kill the current terminal (e.g., closes the graphical interface)
The most well-known rescue combination:
Alt + SysRq + R E I S U B -> Hold down the Alt + SysRq keys while pressing each one in turn.
(R β check keyboard, E β terminate, I β kill, S β sync, U β unmount, B β reboot)
This allows you to βsafely restart a frozen computer.β Magic SysRq = The kernel's secret rescue menu. Even if normal methods don't work, when the system crashes or freezes, you can at least:
- recover data,
- shut down properly,
- and obtain information for debugging.