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.
- R: take control the keyboard from X Server
- E: send SIGTERM signal to all processess (prepare them to death[2]) except init
- I: send SIGKILL signal to all processess (kill them[3]) except init
- S: sync all mounted filesystem
- U: unmount all filesystem and automatically sync them
- B: reboot without unmounting and syncing filesystem
- O: shutdown
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.