The Magic SysRq key

Pressing Alt + SysRq + key produces results described in the table below.

For security purposes, such as preventing casual users from using Alt+SysRq+c to cause a system crash, the kernel.sysrq value as set by sysctl is usually restricted by via a configuration setting. On Fedora, /usr/lib/sysctl.d/50-default.conf contains the following lines:

# System Request functionality of the kernel (SYNC)
#
# Use kernel.sysrq = 1 to allow all keys.
# See http://fedoraproject.org/wiki/QA/Sysrq for a list of values and keys.
kernel.sysrq = 16

The value 16 enables only the Sync all mounted filesystems function; all others are disabled by default. To get access to the other functions, run:

sysctl -w kernel.sysrq=1
Key Action
0 - 9 Set the console log level (controls types of kernel messages sent to the console)
b Immediately reboot the system, without unmounting or syncing filesystems
c Perform a system crash. A crashdump will be taken if it is configured.
d Display all currently held Locks (CONFIG_LOCKDEP kernel option is required)
e Send the SIGTERM signal to all processes except init (PID 1)
f Call oom_kill, which kills a process to alleviate an OOM condition
h Output a terse help document to the console
i Send the SIGKILL signal to all processes except init
j Forcibly “Just thaw it” – filesystems frozen by the FIFREQRE ioctl.
k Kill all processes on the current virtual console (can kill X and SVGALib programs)
l Shows a stack backtrace for all active CPUs.
m Output current memory information to the console
n Reset the nice level of all high-priority and real-time tasks
o Shut off the system
p Output the current registers and flags to the console
q Display all active high-resolution timers and clock sources.
r Switch the keyboard from raw mode, used by programs such as X11 and SVGALib, to XLATE mode
s Sync all mounted filesystems
t Output a list of current tasks and their information to the console
u Remount all mounted filesystems in read-only mode
v Forcefully restore framebuffer console (ARM CPUs: cause ETM buffer dump)
w Display list of blocked (D state) tasks
x (Used by xmon interface on PowerPC platforms)
y Show global CPU registers (SPARC-64 specific)
z Dump the ftrace buffer
space Print a summary of available magic SysRq keys