Ade Malsasa Akbar contact
Senior author, Open Source enthusiast.
Saturday, April 4, 2015 at 17:41

If you somehow find your Linux system crashes, do not kill (pressing power button) the computer directly. Such hard kill may broke your hard disk drive or corrupt your data. When you are facing system hang or crash or freeze, you can use Linux special shortcut keys to restart or shutdown safely. It is actually something called Linux Magic SysRq Keys[1]. Do not use these shortcut keys unless you need it urgently. And you can use these shortcut keys on another Linux distro. 

Restart



Alt + Printscreen + REISUB

It means hold the Alt and printscreen by right hand, then press R + E + I + S + U + B by left hand. Respectively, I show below explanation for each key.

  1. R: take control the keyboard from X Server
  2. E: send SIGTERM signal to all processess (prepare them to death[2]) except init
  3. I: send SIGKILL signal to all processess (kill them[3]) except init
  4. S: sync all mounted filesystem
  5. U: unmount all filesystem and automatically sync them
  6. B: reboot without unmounting and syncing filesystem
  7. O: shutdown 
I recommend you to type it respectively although you can type it just Alt+Printscreen+B only. It is because REISUB is safer than only B[4].

Shutdown



Alt + Printscreen + REISUO

It means the same with restart interrupt above except the O.

Logout



Alt + Printscreen + K

You will be logged out to your display manager (your login screen). It is not a part from Magic SysRq but it works. It is X Server killer. It will kill your X Server therefore all GUI applications will be killed too and you will dropped into your display manager. Note: if you are not using X, e.g. in full CLI environment, then this shortcut key will not work.

Reference



  1. http://en.wikipedia.org/wiki/Magic_SysRq_key
  2. http://en.wikipedia.org/wiki/Unix_signal#SIGTERM
  3. http://en.wikipedia.org/wiki/Unix_signal#SIGKILL
  4. http://ubuntuforums.org/showthread.php?t=1509765