×

Linux Keyboard Shortcuts: Safe Way to Exit During System Freezes

In Windows, when your system hangs, you can always press Ctrl-Alt-Delete, wait for the Task Manager to open, and kill the process that doesn’t respond. However, Ctrl-Alt-Delete don’t always work the way you want it to leaving you no other option but to do a hard-reset, and perhaps as a result corrupt your data kissing your important files goodbye.

In Linux, when your entire system freezes, there are plenty of safe ways to exit and get back on track immediately. Alt + SysRq + (a selection of other keys) will do the magic trick. Note: 'SysRq' key is equivalent to the 'Print Screen' key.

Alt + SysR + K
Kill all processes (including X), which are running on the currently active virtual console.

Alt + SysRq + E
Send the TERM signal to all running processes except init, asking them to exit.

Alt + SysRq + I
Send the KILL signal to all running processes except init.

Alt + SysRq + L
Send the KILL signal to all processes, including init.

Alt + SysRq + S
Run an emergency sync (cache write) on all mounted filesystems. This can prevent data loss.

Alt + SysRq + U
Remount all mounted filesystems as read-only. This has the same effect as the sync combination above, but with one important benefit: if the operation is successful, fsck won't have to check all filesystems after a computer hardware reset.

Alt + SysRq + R
Turn off keyboard raw mode. This can be useful when your X session hangs. After issueing this command you may be able to use .

Alt + SysRq + B
Reboot immediately without syncing or unmounting your disks. Using this, you will likely end up with filesystem errors, so this is not highly recommended.

Alt + SysRq + O
Shut the system off right away.

If all these ‘Alt + SysRq’ keyboard combo are hard to remember, you can press Alt + SysRq + H to display a helpful list of the shortcuts above.

Anonymous #
alt+sysrq+h = launch a metric f%$-ton of screen shot save requests.
Anonymous #
The first thing you should try in something hangs, is just Alt-SysRq-K (or Ctrl-Shift-Backspace while in a graphic X environment, which is a little less brutal). But mostly plain patience will do the trick.

A great way to use these keys is holding down Alt-SysRq while slowly typing REISUB (BUSIER backwards). This will reboot your system in a safe way (just look at the explanations above).

Also note: Alt-SysRq-H only helps you out in the command line.
Anonymous #
Linux can freeze? wow

I`ll stick with my MS Windows 95®
An easy mnemonic for the sequence of keys: just remember 'REISUB', or 'BUSIER' backwards.

Although I use only 'SUB' and never had any problems.
Anonymous #
I was under the impression that we were to "Raise the elephants." RSEIUB
Anonymous #
But wait...
From all the FUD I thought Linux NEVER froze up...

You all lied?
Anonymous #
Only fanboys lie no system is "safe" or crash free. If your truely interested in an OS you should research it a good way to do that is to read tech support forums for said OS.
Anonymous #
Raising Skinny Elephants Is Utterly Boring.
No, no, no,

its

Raising
Elephants
Is
So
Utterly
Boring
Alt + SysReq + REISUB
Anonymous #
Yeah, I think that I'll be writing a post to link to this page. I often suggest Linux to friends as an alternative to Windows but the truth is, EVERY OS is going to run into situations that bring grief.

I like the longer interval between those situations in Linux. But that means that I tend to forget how to get out of the jams.
Good one... ;) Screenies for everyone... And lots of them too... ;)
Anonymous #
The lockups happen so seldom that I can never remember these key sequences. But Ctrl+Alt+Delete? I'll NEVER forget that one.
Anonymous #
Very useful!

For Fedora you need to use
AltGR + SysReq + ....

otherwise you get a print screen image dump window if you are running X.
Anonymous #
A pitty that there is no "print" button/layout on this page to print out these useful shortcuts :(
Anonymous #
Reboot
Even
If
System
Utterly
Broken
Anonymous #
"But wait...
From all the FUD I thought Linux NEVER froze up...

You all lied?"

Nope, you just didn't get it.

Linux, the kernel, does not crash. Only the applications crash. And since the kernel don't crash you can happily recover (by being able to reboot gracefully) from any application crash.

Of course, Linux does make a "kernel panic" in which most of the time hardware issues are to blame.

I have experienced kernel panics mostly when I am compiling my own kernel. While the BSODs simply became part of any Windows users daily routine.
well, I too tried the alt+sysrq+h command and had a plethoria of screen captures open up slowing down my display making it appear frozen.

My simple solution was ctrl-alt-backspace which restarts the x window session) (killing all child processes in the meantime - including the screen capture one).

I logged back in and was ready to carry on work again. The computer didn't ahve to be rebooted. All my drive mappings were still there.

I reopened firefox and all the pages I was reading were reloaded.

I reopened my music play and the song I was listening to was queued and ready to start playing again.

Total time - to productivity again - perhaps 15 seconds.
If you're having the screenshot (screen capture) try this; it worked for me in Ubuntu:
add this line to the end of /etc/sysctl.conf

kernel.sysrq = 1

then reboot.

For it to work properly, you need to press alt+sysrq simultaneously, then press your exit code (eg k) while holding the other keys down.
Anonymous #
Ctrl+Alt+Esc usually do the thrick for me ;)
Anonymous #
Anyone know what the sysrq button is on a macbook keyboard?
Anonymous #
Windows 95? There hasn't been a new security update for that in close to a decade, but there are new attacks against it almost day. Having a Windows 95 box hooked to the internet is akin to walking naked into a prison carrying a carton of cigarettes.
Anonymous #
Linux can freeze for a reason, whereas
Windows freeze for no reason, even bythemselves.

There is no such thing as "unfreezable" system.

But lets say that one new computer user can harm Windows much more easily than a linux distribution...

All the above in my opinion of course..
Anonymous #
For no reason, right. Windows has this randomly firing freeze driver.
As if the common user would know why his Linux box freezes!
youngdaddytc #
ctrl + alt + backspace. definitely the way to go.
I had heard about it but to be completely honest I thought it was a myth.

Yes Virginia there Really Are WindBlows FanBoys.
Anonymous #
did you try CTRL+SHIFT+ESC to open Task Manager??? so you wrote "However, Ctrl-Alt-Delete don’t always work the way you want it to leaving you no other option but to do a hard-reset"... But if you try CTRL+SHIFT+ESC, you can reach Task manager easyly..
Loved reading these comments. Its so unusual, but not impossible for a linux desktop to lockup. This blog is nice reminder that a linux desktop can be safely terminated and system restarted in an orderly manner. Yah now!