Tutorials

Control Console with SysReq

System request (often abbreviated SysRq or Sys Req) is a key on keyboards for PCs that has no standard use. This key can be traced back to the operator interrupt key of the IBM System/370 mainframe computer. But under Linux there's a bunch of useful things available via this key.

Note that this is documented only on i386 on Linux, and the kernel must be compiled with the "Magic SysRq Key" option. Find out if it has been by looking at /proc/sys/kernel/sysrq and seeing if that file contains '1'.

Press Alt-Sysreq followed by one of the following letters:

Key Result
r Unraw: Restores the keyboard after an X crash or similar.
0 Changes console loglevel to 0 and so reduces error messages.
k System attention key: Kills all processes on the current virtual console.
e Terminate: Kills all processes except init on the current terminal.
i Kill: Kills all processes except init, everywhere.
s Sync: Attempts to sync all mounted filesystems. Outputs OK and Done when it's managed. This can reduce the chances of needing to run fsck at a later stage so it can be useful if you're having disk problems.
u Umount: Attempts to remount all mounted filesystems read-only.
b Reboot: immediately reboots the system without syncing or unmounting disks. Not a good idea unless in extremis! This may lead to data loss.
p Dumps current registers and flags to the console.
m Dumps current memory info to the console.

Create GUI Applications with Python & Qt5 by Martin Fitzpatrick

(PySide2 Edition) The hands-on guide to making apps with Python — Over 15,000 copies sold!

More info Get the book

Elsewhere

Control memcached from the command line
Find all files containing a given string
Collaborate in the shell with screen (multiuser)
Kivy's Complex Widgets