Master the SysRq Key to Fix Any Linux Freeze-Up

No system is immune to hangs and freeze-ups, and that includes even the most austere Linux desktop. What sets Linux apart is a key that can call out to the core kernel to un-freeze your desktkop, kill memory-hogging services, and cause a clean restart.

You'll need a full-size keyboard with a SysRq key, of course, or a laptop with the key available through a Function option. If you have that key, check that it's enabled as a "magic" system-level switch with this terminal command, which should return with a "1":

cat /proc/sys/kernel/sysrq

Assuming that's the case, you can then hold Alt+SysRq and tap certain keys to take semi-emergency actions—Alt+SysRq+r, for example, gives you back the keyboard if it's stopped responding, and you can then restart your system, restart a graphical X server, and so on. The How-To Geek site has a full list of commands and setup instructions for empowering that little-used key. Photo by solylunafamilia.

Use the Magic SysRq Key on Linux to Fix Frozen X Servers, Cleanly Reboot, and Run Other Low-Level Commands | How-To Geek