Complete Guide on SysRq Key in Linux

Last update: 07/02/2025
Author Isaac
  • The SysRq key allows direct control of the kernel in emergencies.
  • It is necessary to activate it manually in many distributions of Linux modern.
  • Combinations like REISUB help to reboot blocked systems safely.

What are the function keys f1 to f12-5 for?

The SysRq key , also known as the "magic key," is a peculiar and often overlooked feature on many keyboards that can be a real lifesaver in computer emergencies. Although it's usually located next to the Print Screen ( PrtSc ) key, its true potential lies in specific key combinations that allow you to perform essential tasks in Linux when the operating system becomes unresponsive.

This feature, integrated directly into the Linux kernel , is designed to give the user absolute control over the system, even in the most critical moments. However, its use requires some preparation and knowledge, as it is not always enabled by default and can be a double-edged sword if not used correctly. Here we will explore everything related to this enigmatic key in detail.

What exactly is the SysRq key?

linux sysrq

The SysRq key, short for "System Request," is a special tool integrated into the Linux kernel that allows users to perform numerous administrative and recovery tasks directly from the keyboard. Its original implementation was intended to give users a way to interact with the system kernel in extreme situations, such as system crashes or failures.

On modern keyboards, this key is usually labeled "Print Screen , " "PrtSc," or even "SysRq ." However, its true utility goes far beyond taking screenshots . This "magic" is accessible through specific key combinations that allow you to send commands directly to the kernel.

How to enable and configure SysRq

To use this feature, it must be enabled on your system. In many modern Linux distributions, SysRq is disabled by default. Enabling it is a simple process, but it requires administrator privileges . The key steps are detailed below:

  • Edit the configuration file /etc/sysctl.conf to add the line kernel.sysrq=1.
  • Save changes and apply the settings by typing sysctl -p in the terminal.
  What is Brush, the Rust-based shell compatible with bash?

If you don't want the change to be permanent, you can enable it temporarily by running the command echo "1" > /proc/sys/kernel/sysrq. This setting will be reverted when rebooting the system.

Main functions of the SysRq key

Key combinations using this key allow you to perform critical tasks such as restarting the system, synchronizing disks, killing frozen processes, and much more. These actions are performed by pressing Alt + SysRq followed by a specific letter. The most common combinations are:

  • R: Regains keyboard control, useful if the graphical environment is blocked.
  • E: Terminate all processes in an orderly manner with SIGTERM.
  • I: Kill all processes forcibly with SIGKILL.
  • S: Synchronizes data from file systems to disk.
  • U: Remount all filesystems as read-only.
  • B: Reboot the system immediately.

These key combinations are especially useful in emergencies . For example, if your system freezes and becomes unresponsive to your usual commands, the REISUB sequence (press the keys in that order) can safely and gracefully restart your computer, reducing the risk of data corruption.

Additional combinations and their purpose

In addition to the basic combinations mentioned above, there are other less common ones that allow you to perform even more specific tasks:

  • H: Displays a help list of available combinations.
  • M: Dumps detailed information from system memory.
  • K: Kill all active processes in the current console.
  • O: Turn off the equipment completely.
  • T: Displays a list of all active tasks in the system.

These options increase the versatility of SysRq, allowing advanced system management in critical moments.

Security considerations

Although SysRq is an extremely useful tool, it can also be dangerous if used incorrectly. For this reason, it is important to restrict its use only to authorized users and ensure that systems are not exposed to unwanted access. If you administer remote servers and prefer to disable this feature, you can do so by configuring kernel.sysrq=0 in the system.

  Create and Master Makefiles: Automate the Compilation of Your Projects

In Linux, SysRq functionality is not typically available over SSH connections , limiting its use to local system interactions. This acts as an additional security measure to prevent accidental or malicious disruptions.

The SysRq key has a fascinating history and a utility that doesn't always get the attention it deserves. With this knowledge, you can take full advantage of its capabilities and be prepared to deal with any critical situation that may arise on your system.