in

Linux Keyboard Shortcuts: Safe Way to Exit During System Freezes

- - 27 comments
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.

27 comments

  1. alt+sysrq+h = launch a metric f%$-ton of screen shot save requests.

    ReplyDelete
  2. 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.

    ReplyDelete
  3. Linux can freeze? wow

    I`ll stick with my MS Windows 95®

    ReplyDelete
  4. An easy mnemonic for the sequence of keys: just remember 'REISUB', or 'BUSIER' backwards.

    Although I use only 'SUB' and never had any problems.

    ReplyDelete
  5. I was under the impression that we were to "Raise the elephants." RSEIUB

    ReplyDelete
  6. But wait...
    From all the FUD I thought Linux NEVER froze up...

    You all lied?

    ReplyDelete
  7. 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.

    ReplyDelete
  8. Raising Skinny Elephants Is Utterly Boring.

    ReplyDelete
  9. No, no, no,

    its

    Raising
    Elephants
    Is
    So
    Utterly
    Boring
    Alt + SysReq + REISUB

    ReplyDelete
  10. 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.

    ReplyDelete
  11. Good one... ;) Screenies for everyone... And lots of them too... ;)

    ReplyDelete
  12. The lockups happen so seldom that I can never remember these key sequences. But Ctrl+Alt+Delete? I'll NEVER forget that one.

    ReplyDelete
  13. Very useful!

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

    otherwise you get a print screen image dump window if you are running X.

    ReplyDelete
  14. A pitty that there is no "print" button/layout on this page to print out these useful shortcuts :(

    ReplyDelete
  15. Reboot
    Even
    If
    System
    Utterly
    Broken

    ReplyDelete
  16. "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.

    ReplyDelete
  17. 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.

    ReplyDelete
  18. 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.

    ReplyDelete
  19. Ctrl+Alt+Esc usually do the thrick for me ;)

    ReplyDelete
  20. Anyone know what the sysrq button is on a macbook keyboard?

    ReplyDelete
  21. 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.

    ReplyDelete
  22. 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..

    ReplyDelete
  23. AnonymousJuly 07, 2009

    For no reason, right. Windows has this randomly firing freeze driver.
    As if the common user would know why his Linux box freezes!

    ReplyDelete
  24. youngdaddytcMarch 18, 2010

    ctrl + alt + backspace. definitely the way to go.

    ReplyDelete
  25. I had heard about it but to be completely honest I thought it was a myth.

    Yes Virginia there Really Are WindBlows FanBoys.

    ReplyDelete
  26. 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..

    ReplyDelete
  27. 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!

    ReplyDelete