This article provides a list of (not commonly known) default keyboard shortcuts and provides information about user customization.
There are several low level shortcuts that are implemented in the kernel 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).
To use these, they must first be activated with either
sysctl kernel.sysrq=1 or
echo "1" > /proc/sys/kernel/sysrq. If you wish to have it enabled during boot, edit
/etc/sysctl.d/99-sysctl.conf and insert the text
kernel.sysrq = 1. 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.
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.|
- 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
See Wikipedia:Magic SysRq key for more details.
|| Reboots Computer (specified by the symlink |
||Switch to n-th virtual console|
||Switch to previous virtual console|
||Switch to next virtual console|
||When Scroll Lock is activated, input/output is locked|
||Scrolls console buffer up/down|
||Kills current task|
||Inserts an EOF|
||Pauses current Task|
GNU readline is a commonly used library for line-editing; it is used for example by Bash, FTP, and many more (see the details ofpackage under "Required By" for more examples). readline is also customizable (see man page for details).
||Clear the screen|
||Move cursor one character to the left|
||Move cursor one character to the right|
||Move cursor one word to the left|
||Move cursor one word to the right|
||Move cursor to start of the line|
||Move cursor to end of the line|
|Copy & Paste|
||Cut everything from line start to cursor|
||Cut everything from the cursor to end of the line|
||Cut the current word after the cursor|
||Cut the current word before the cursor|
||Paste the previous cut text|
||Paste the second latest cut text|
||Paste the first argument of the previous command|
||Paste the last argument of the previous command|
||Move to the previous line|
||Move to the next line|
||Abort search (restores original line)|
||Restores all changes made to line|
||Auto-complete a name|
||List all possible completions|
||Insert all possible completions|
X11 & Wayland
||Switch to n-th virtual console|| If it does not work, try |
||Paste text from the PRIMARY buffer|| By default, Qt maps |
This example adds keys that allow (in vi-mode) to search backward through the history for the string of characters between the start of the current line and the point. This is a non-incremental search.
set editing-mode vi set keymap vi-insert "\C-r": history-search-backward "\C-e": history-search-forward
See Keyboard configuration in Xorg#Frequently used XKB options for some common shortcuts, that are disabled by default.
Key binding for X-selection-paste
Users who prefer to work rather with the keyboard 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.
F12to paste the buffer, instead of moving the mouse pointer to the field and center-click to paste.
Shift+Inserthas a similar yet different functionality, see #X11:
Shift+Insertinserts the clipboard buffer, not the x-selection-paste buffer. In some applications, these two buffers are mirrored.
The method suggested here uses three packages available in the official repositories:
- 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" F12
"\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
F12 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) ]
Using xdotool - command-line X11 automation tool
With theit is possible to create a short cut which actually pastes the content of the X-Selection buffer via triggering the middle mouse button. Instead of hit the text as separate key strokes. The command for the short cut is:
xdotool getwindowfocus key --window %1 click 2
The command get the window which has focus from the xserver and triggers a click of button 2 which is the middle mouse button.
Tips and tricks
- If you like a keyboard-centered workflow, you might also appreciate a tiling window manager.