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”:
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.