Keyboard shortcuts

From ArchWiki
Revision as of 03:38, 23 October 2018 by Comrumino (talk | contribs) (Key binding for X-selection-paste: Corrected section introduction which assumed the user already bound the x-selection-paste to F12 for accuracy; improved the note for clarity)
Jump to: navigation, search

This article provides a list of (not commonly known) default keyboard shortcuts and provides information about user customization.

Standard shortcuts


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, add kernel.sysrq = 1 to your sysctl configuration. 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.

Keyboard Shortcut Description
Alt+SysRq+r Unraw Take control of keyboard back from X.
Alt+SysRq+e Terminate Send SIGTERM to all processes, allowing them to terminate gracefully.
Alt+SysRq+i Kill Send SIGKILL to all processes, forcing them to terminate immediately.
Alt+SysRq+s Sync Flush data to disk.
Alt+SysRq+u Unmount Unmount and remount all filesystems read-only.
Alt+SysRq+b Reboot Reboot
  • If you are using a display manager and after Alt+SysRq+e you are presented with the login screen (or full desktop if autologin is enabled), it is most likely caused by Restart=always directive 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 Alt key.
  • On laptops that use Fn key to differentiate SysRq from PrtScrn, it may not actually be necessary to use the Fn key (i.e., Alt+PrtSc+letter could work).
  • On Lenovo laptops SysRq is often configured as Fn+S. To use it press and hold Alt then press Fn+s, release Fn and s still holding Alt followed by the keys above.
  • You may need to press Ctrl along with Alt. So for example, full key shortcut would be Ctrl+Alt+SysRq+b.

See Wikipedia:Magic SysRq key for more details.


Virtual console

See Linux console#Keyboard shortcuts.


Tango-edit-cut.pngThis section is being considered for removal.Tango-edit-cut.png

Reason: Duplicates Info documentation. (Discuss in Talk:Keyboard shortcuts#)

Readline is a commonly used library for line-editing; it is used for example by Bash, FTP, and many more (see the details of readline package under "Required By" for more examples). Readline is also customizable, see examples on the readline page.

Keyboard Shortcut Description
Ctrl+l Clear the screen
Cursor Movement
Ctrl+b Move cursor one character to the left
Ctrl+f Move cursor one character to the right
Alt+b Move cursor one word to the left
Alt+f Move cursor one word to the right
Ctrl+a Move cursor to start of the line
Ctrl+e Move cursor to end of the line
Copy & Paste
Ctrl+u Cut everything from line start to cursor
Ctrl+k Cut everything from the cursor to end of the line
Alt+d Cut the current word after the cursor
Ctrl+w Cut the current word before the cursor
Ctrl+y Paste the previous cut text
Alt+y Paste the second latest cut text
Alt+Ctrl+y Paste the first argument of the previous command
Alt+./_ Paste the last argument of the previous command
Ctrl+p Move to the previous line
Ctrl+n Move to the next line
Ctrl+s Search
Ctrl+r Reverse search
Ctrl+j End search
Ctrl+g Abort search (restores original line)
Alt+r Restores all changes made to line
Tab Auto-complete a name
Alt+? List all possible completions
Alt+* Insert all possible completions

Xorg and Wayland

Keyboard Shortcut Description Notes
Ctrl+Alt+F1, F2, F3, ... Switch to n-th virtual console If it does not work, try Ctrl+Fn+Alt+F….
Mouse Button 2
Paste text from the PRIMARY buffer By default, Qt maps Shift+Insert to CLIPBOARD instead of the PRIMARY buffer (see e.g. [1]) and Ctrl+Shift+Insert is mapped to the PRIMARY buffer.



Readline has Emacs-like and vi-like editing modes which can be customized with escape sequences.


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:

actkbdAUR (available in 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.

A sample configuration and guide is available here.


xbindkeys allows advanced mapping of keysyms to actions independently of the Desktop Environment.

Tip: If you find xbindkeys difficult to use, try the graphical manager xbindkeys_config-gtk2AUR from the AUR.

Key binding for X-selection-paste

Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

Reason: Why the 100ms delay? (Discuss in Talk:Keyboard shortcuts#)

Users that prefer to work with the keyboard rather than the mouse may benefit from a key binding for the paste operation of the middle mouse button. This is especially useful in a keyboard-centered environment. So, rather than moving the mouse pointer to the field and center-click to paste, it would be ideal to have a key binding to the middle mouse button:

  1. In Firefox, select a string you want to google for (with the mouse).
  2. Hit Ctrl+K to enter the "search engine" field.
  3. Hit Shift+Insert or Ctrl+V will paste the clipboard selection, but to insert the X-selection-paste there needs to be a key binding say F12.
Note: Shift+Insert inserts the clipboard buffer on most GTK applications, not the X-selection-paste buffer (X-selection-paste buffer refers to primary buffer). In other applications such as uxterm, Shift+Insert does insert the X-selection-paste buffer.

The method suggested here uses three packages available in the official repositories:

  • xsel to give access to the X-selection-buffer content.
  • Xbindkeys to bind a key-stroke to an action.
  • xvkbdAUR to pass the buffer string to the application by emulating keyboard input.

This example binds the X-selection-paste operation to the F12 key:

"xvkbd -no-jump-pointer -xsendevent -text "\D1`xsel`" 2>/dev/null"

The "\D1" code prefixes a 100 ms pause to inserting the selection buffer (see the xvkbd home page).

Note: Depending on your X configuration, you may need to drop the -xsendevent argument to xvkbd.

The key codes for keys other than F12 can be determined using xbindkeys -k.


XMonad Window Manager

In the xmonad window manager there is a built-in function to paste the x-selection-buffer content. In order to bind that function to a key-stroke (here Insert key) the following configuration can be used:

import XMonad.Util.Paste
  -- X-selection-paste buffer
  , ((0,                     xK_Insert), pasteSelection) ]

Tips and tricks

See also