Good To Know: 7 Secret Linux Keyboard Shortcuts That Might Save Your System

All Linux distributions contain secret keyboard shortcuts built-into the kernel, find out what they are and what do they do?

Updated Mar 9, 2017How To's
Linux secret keyboard shortcuts

If you find yourself in a situation where your Linux system suddenly freezes, be it on whatever distro you’re using at the moment, what do you do? do you immediately reach out to the reset button or power switch?

Well, if you do then just so you know hard rebooting – a reboot that’s done not in an orderly manner, skipping filesystem synchronization and other activities – can sometimes cause corruption of the filesystem, meaning you might lose some precious data.

That’s why you should only opt for hard rebooting as a last resort in case all other options are depleted. And since we’re talking about a system freeze here, you might think that’s the case.

Well, not necessarily.

Meet The Magic SysRq Key

The magic SysRq (system rescue) key “is a key combination understood by the Linux kernel, which allows the user to perform various low-level commands regardless of the system’s state” according to Wikipedia.

It generally consists of Alt + SysRq and another key that specifies the command to issue.

Qwerty keyboard: Alt + SysRq

Qwerty keyboard: Alt + SysRq

Note: On some keyboards where the SysRq key isn’t present, PrtScn key is used instead.

While many of these commands may only appeal to developers or users of very high tech level, at least 7 of them can be actually quite useful to the average user as well.

So, circling back to the example I gave at the beginning of the article, when your system freezes what do you do? you use the Magic SysRq key combo in the following order:

  1. unRaw – first, you take control of your keyboard back from X (necessary only if the keyboard stopped functioning)
  2. tErminate – next, you send close signal to all processes, allowing them to terminate gracefully
  3. kIll – some processes might misbehave and refuse to close gracefully, thus you would now send a kill signal to all processes, forcing them to terminate immediately
  4. Sync –  here, you “flush” unsaved data to the disk in order for it to be saved
  5. Unmount – this option will remount all filesystems in “read-only” mode so that no further changes could be made to them
  6. reBoot – if restarting the system is the goal
  7. pOwer off – in case you wish to shut down your computer

Example: to execute the first command you use Alt + SysRq + R. For the second – Alt + SysRq + E and so on.

Obviously, as with all commands, the sequence might be a bit hard to memorize at first, therefore here are a couple of methods that may help you remember:

Use the sentences “Raising Elephants Is So Utterly Boring” or “Reboot Even If System Utterly Broken” or simply the word “BUSIER” read backwards (you can replace the “B” word with an “O” word for the power off option: “Raising Elephants Is So Utterly Overrated”).

There you go. It may not work in all 100% of system freezes, but in cases that aren’t due to a kernel panic or hardware failure there’s a good chance it will and may save you from precious data loss.