This article provides a list of (not commonly known) default keyboard shortcuts and provides information about user customization.
- 1 Standard shortcuts
- 2 Customization
- 3 Tips and tricks
- 4 See also
There are several low level shortcuts that are implemented in the kernel via the sysrq key which can be used for debugging and recovering from an unresponsive system. Whenever possible, it is recommended that you use these shortcuts instead of doing a hard shutdown (holding down the power button to completely power off the system).
See Wikipedia:Magic SysRq key for more details.
systemd has the sysrq permissions bitmask set to 0x10 by default, which does not allow process signalling or rebooting, among other things. To allow full use of the sysrq key on your system, add
kernel.sysrq = 1 to your sysctl configuration. Values greater than 1 can be used to selectively enable sysrq functions; see the Linux kernel documentation for details. If you want to make sure it will be enabled even before the partitions are mounted and in the initrd, then add
sysrq_always_enabled=1 to your kernel parameters.
Note that changing the setting through these methods will cause the changes to persist across reboots. If you want to try changing the sysrq settings for just your current session, you can run either
sysctl kernel.sysrq=1 or
echo "1" > /proc/sys/kernel/sysrq.
There are some obvious security risks involved in fully enabling the sysrq key. In addition to forcing reboots and the like, it can be used to dump the contents of the CPU registers, which could theoretically reveal sensitive information. Since using it requires physical access to the system (unless you go out of your way), most desktop users will probably consider the level of risk acceptable. That said, make sure you fully understand the implications of enabling it and the dynamics of the larger context in which your system is operating before you turn sysrq all the way on.
A common idiom to remember this is "Reboot Even If System Utterly Broken" (also referred to as "REISUB"). Alternatively, think of it as "BUSIER" backwards.
||Take control of keyboard back from X.|
||Send SIGTERM to all processes, allowing them to terminate gracefully.|
||Send SIGKILL to all processes, forcing them to terminate immediately.|
||Flush data to disk.|
||Unmount and remount all filesystems read-only.|
Killing a memory-hogging process
Alt+SysRq+f can be used to invoke the OOM (out-of-memory) killer without causing a kernel panic if nothing can be killed. The OOM killer uses a set of heuristics to pick whichever relatively non-vital process is using the most memory and kill it. This is very useful to kill a process that is softlocking your system by causing excessive thrashing, such as a runaway browser script, and can alleviate the need for a reboot in many cases. Note that the OOM killer can target a wide variety of processes despite its well-meaning heuristics and can be somewhat unpredictable, so be careful about calling it casually.
- If you are using a display manager and after
Alt+SysRq+eyou are presented with the login screen (or full desktop if autologin is enabled), it is most likely caused by
Restart=alwaysdirective in the relevant service file. If necessary, edit the unit, however this should not prevent the "REISUB" sequence from working.
- If all the above combinations work except
Alt+SysRq+b, try using the contralateral
- On laptops that use
Fnkey to differentiate
PrtScrn, it may not actually be necessary to use the
- On Lenovo laptops
SysRqis often configured as
Fn+S. To use it press and hold
Altfollowed by the keys above.
- You may need to press
Alt. So for example, full key shortcut would be
Xorg and Wayland
||Switch to n-th virtual console||If it does not work, try |
||Paste text from the PRIMARY buffer||By default, Qt maps |
Readline is a commonly used library for line-editing; it is used for example by Bash, FTP, and many more (see the details of package under "Required By" for more examples). It has Emacs-like and vi-like editing modes which can be customized with escape sequences. Default key bindings are listed in the Info documentation.
See Xorg/Keyboard configuration#Frequently used XKB options for some common shortcuts, that are disabled by default.
When we are in a graphical environment we may want to execute a command when certain key combination is pressed (i.e. bind a command to a keysym). There are multiple ways to do that:
- The most portable way using low level tools, such as acpid. Not all keys are supported, but configuration in uniform way is possible for keyboard keys, power adapter connection and even headphone jack (un)plugging events. It is also difficult to run programs inside X session correctly.
- The universal way using Xorg utilities (e.g. xbindkeys) and eventually your desktop environment or window manager tools.
- The quicker way using a third-party program to do everything in GUI, such as the Gnome Control Center.
A simple X hotkey daemon with a powerful and compact configuration syntax. See sxhkd for details.
From actkbd home page:
- AUR) is a simple daemon that binds actions to keyboard events. It recognises key combinations and can handle press, repeat and release events. Currently it only supports the linux-2.6 evdev interface. It uses a plain-text configuration file which contains all the bindings. AUR (available in
A sample configuration and guide is available here.
xbindkeys allows advanced mapping of keysyms to actions independently of the Desktop Environment.
xbindkeysdifficult to use, try the graphical manager AUR from the AUR.
Key binding for X-selection-paste
Users who prefer to work with the keyboard rather than the mouse may benefit from a key binding to the paste operation of the middle mouse button. This is especially useful in a keyboard-centered environment. A workflow example is:
- In Firefox, select a string you want to google for (with the mouse).
Ctrl+kto enter the "search engine" field.
F9to paste the buffer, instead of moving the mouse pointer to the field and middle-click to paste.
Shift+Inserthas a similar yet different functionality, see #Xorg:
Shift+Insertinserts the clipboard buffer, not the x-selection-paste buffer. In some applications, these two buffers are mirrored.
The method suggested here uses the following three packages::
- to give access to the x-selection-buffer content.
- Xbindkeys to bind a key-stroke to an action.
- AUR to pass the buffer string to the application by emulating keyboard input.
This example binds the x-selection-paste operation to the
"xvkbd -no-jump-pointer -xsendevent -text "\D1`xsel`" 2>/dev/null" F9
"\D1" code prefixes a 100 ms pause to inserting the selection buffer (see the xvkbd home page).
-xsendeventargument to xvkbd.
The key codes for keys other than
F9 can be determined using
XMonad Window Manager
Insert key) the following configuration can be used:
import XMonad.Util.Paste ... -- X-selection-paste buffer , ((0, xK_Insert), pasteSelection) ]
Tips and tricks
- If you like a keyboard-centered workflow, you might also appreciate a tiling window manager.