Linux kernel Magic SysRq Key

Kernel Panic了就有用了

The magic SysRq key is a key combination in the Linux kernel which allows the user to perform various low level commands regardless of the system’s state.



临时打开Magic SysRq Key支持

echo 1 > /proc/sys/kernel/sysrq
sysctl -w kernel.sysrq=1




k Kills all the process running on the current virtual console
s 同步所有已经挂载的文件系统.
n Reset the nice level of all high-priority and real-time tasks
d Display all currently held Locks
c Reboot kexec and output a crashdump
g When using Kernel Mode Setting, provides emergency support for switching back to the kernel's framebuffer console
b 立即重启系统,不卸载分区和同步文件.
e 给除了init以外的所有进程发送SIGTERM信号,可以试图正常结束所有进程。
i Send the SIGKILL signal to all processes except init
m Output current memory information to the console.
r 转换keyboard 到 XLATE mode.(摆脱X的控制)
t Output a list of current tasks and their information to the console.
u 以只读模式重新挂载所有已经挂载的文件系统
o 可能的话,关机。
p Print the current registers and flags to the console.
q Display all active high-resolution timers and clock sources.
0-9 设置终端日志级别
v Output Voyager SMP processor information
w Display list of blocked (D state) tasks
f 调用oom_kill函数来干掉占用很大内存的进程。
h 显示帮助(其他未定义的按键也会显示帮助)


echo b > /proc/sysrq-trigger

Magic SysRq Key最有名的busier(倒过来)组合

unRaw (take control of keyboard back from X11,)
tErminate (send SIGTERM to all processes, allowing them to terminate gracefully),
kIll (send SIGILL to all processes, forcing them to terminate immediately),
Sync (flush data to disk),
Unmount (remount all filesystems read-only),

Author Info :
  • From:Linux kernel Magic SysRq Key
  • URL:
  • Please Reserve This Link,Thanks!
  • 发表评论