2024年4月26日发(作者:)

You can set the value in the file by the following command:

echo "number" >/proc/sys/kernel/sysrq

Note that the value of /proc/sys/kernel/sysrq influences only the invocation

via a keyboard. Invocation of any operation via /proc/sysrq-trigger is always

allowed (by a user with admin privileges).

* How do I use the magic SysRq key?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

On x86 - You press the key combo 'ALT-SysRq-'. Note - Some

keyboards may not have a key labeled 'SysRq'. The 'SysRq' key is

also known as the 'Print Screen' key. Also some keyboards cannot

handle so many keys being pressed at the same time, so you might

have better luck with "press Alt", "press SysRq", "release SysRq",

"press ", release everything.

On SPARC - You press 'ALT-STOP-', I believe.

On the serial console (PC style standard serial ports only) -

You send a BREAK, then within 5 seconds a command key. Sending

BREAK twice is interpreted as a normal BREAK.

On PowerPC - Press 'ALT - Print Screen (or F13) - ,

Print Screen (or F13) - may suffice.

On other - If you know of the key combos for other architectures, please

let me know so I can add them to this section.

On all - write a character to /proc/sysrq-trigger. e.g.:

echo t > /proc/sysrq-trigger

* What are the 'command' keys?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

'b' - Will immediately reboot the system without syncing or unmounting

your disks.

'c' - Will perform a system crash by a NULL pointer dereference.

A crashdump will be taken if configured.

'd' - Shows all locks that are held.

'e' - Send a SIGTERM to all processes, except for init.

'f' - Will call oom_kill to kill a memory hog process.

'g' - Used by kgdb (kernel debugger)

'h' - Will display help (actually any other key than those listed