When Windows hangs itself we all know what to do right? Were just reaching for the combination [Ctrl]+[Alt]+[Del] (Control Alt Delete). But if you try this in Linux nothing happens (in some distributions, like Ubuntu, you actually get the menu for shutting down your system, but this don’t work when your system hags or freezes).
So what to do?
There is 3 keyboard combinations every Linux user should remember (or write down). But before we begin I want you to understand some of the signs I use: If a symbol is surrounded by [ ] means that it is a button or key on your keyboard. +means that you have to hold the keys down at once. And > means that you have to click the buttons one by one, remember that you have to press each key for 2-3 seconds. Now that you have learned this we can move on to the commands:
Fist you have the combination [Ctrl]+[Alt]+[BackSpace] (backspace is the [←] over[Enter]) that restarts X or GDM (you will be logged out), and you can kind of call it Linux’s Control Alt Delete equivalent. This command gives your programs time to make emergency backups of unsaved files (for example if you writing on a document in Open Office) and it prevents that you get a file system error during the crash.If you use Ubuntu or a distribution based on Ubuntu you will have to use[Alt]+[PrtSc]+[K] (PrtSc = Print Screen) instead, but you should note that some Ubuntu based distros (like Linux Mint) still use the universal [Ctrl]+[Alt]+[BackSpace].
But what to do if this combination doesn’t work?
Then you have to use something called Magic SysRq Keys. In short they are keys which allows you to perform various commands regardless of the system’s state, like in this case get the system to recover from a freeze. Note that these keys wont work if your system is in kernel panic. Like I said there are tree combinations that you will have to remember and since we have already learned one, there are two to go:
This command will get your freezed system to restart safely:
Hold [Alt]+[PrtSc] then type [R]>[E]>[I]>[S]>[U]>[B] (press each key for 2-3 seconds). In short the keys mean: unRaw (take control of keyboard back from X), tErminate (send SIGTERM to all processes, allowing them to terminate gracefully), kIll (send SIGKILL to all processes, forcing them to terminate immediately), Sync (flush data to disk), Unmount (remount all filesystems read-only), reBoot (restart).
A common idiom to perform a safe reboot of a Linux computer which has otherwise locked up, the QWERTY (or AZERTY) mnemonic "Raising Elephants Is So Utterly Boring", "Reboot Even If System Utterly Broken" or simply remembering the word "BUSIER" backwards, is often useful.
This command will get your freezed system to shut down in a safe way:
Again hold [Alt]+[PrtSc] then type [R]>[E]>[I]>[S]>[U]>[O] (press each key for 2-3 seconds). These keys mean: unRaw, tErminate, kIll, Sync, Unmount , shutdOwn (does it really need an explanation?).