Difference between revisions of "Keyboard shortcuts"

From ArchWiki
Jump to: navigation, search
m (package link)
m (X11 & Wayland: style)
 
(62 intermediate revisions by 19 users not shown)
Line 1: Line 1:
 
[[Category:Keyboards]]
 
[[Category:Keyboards]]
[[Category:X Server]]
+
[[Category:X server]]
 
[[Category:Accessibility]]
 
[[Category:Accessibility]]
[[zh-CN:Keyboard Shortcuts]]
+
[[ja:キーボードショートカット]]
{{Article summary start}}
+
[[zh-cn:Keyboard shortcuts]]
{{Article summary text|Default keyboard shortcuts and user customizations.}}
+
This article provides a list of (not commonly known) default keyboard shortcuts and provides information about user customization.
{{Article summary end}}
+
==Standard Shortcuts==
+
===Kernel===
+
These are low level shortcuts that are considered to be used for debugging. Whenever possible, it is recommended to use these instead of doing a hard shutdown (holding power button to shutdown the motherboard).
+
  
Must be activated first with {{ic|echo "1" > /proc/sys/kernel/sysrq}} or if you wish to have it enabled during boot, edit {{ic|/etc/sysctl.d/99-sysctl.conf}} and set kernel.sysrq = 1
+
== Standard shortcuts ==
  
A common idiom to remember this is "'''R'''eboot '''E'''ven '''I'''f '''S'''ystem '''U'''tterly '''B'''roken" (also referred to as "REISUB").
+
=== Kernel ===
  
{|
+
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 {{ic|1=sysctl kernel.sysrq=1}} or {{ic|echo "1" > /proc/sys/kernel/sysrq}}. If you wish to have it enabled during boot, edit {{ic|/etc/sysctl.d/99-sysctl.conf}} and set {{ic|1=kernel.sysrq = 1}}.
 +
 
 +
A common idiom to remember this is "'''R'''eboot '''E'''ven '''I'''f '''S'''ystem '''U'''tterly '''B'''roken" (also referred to as "REISUB"). Alternatively, think of it as "BUSIER"  backwards.
 +
 
 +
{| class="wikitable"
 
! Keyboard Shortcut
 
! Keyboard Shortcut
 
! Description
 
! Description
 
|-
 
|-
| {{ic|Alt}}+{{ic|SysRq}}+{{ic|R}}+ '''Unraw'''  
+
| {{ic|Alt+SysRq+r}} '''Unraw'''  
 
| Take control of keyboard back from X.
 
| Take control of keyboard back from X.
 
|-
 
|-
| {{ic|Alt}}+{{ic|SysRq}}+{{ic|E}}+ '''Terminate'''  
+
| {{ic|Alt+SysRq+e}} '''Terminate'''  
 
| Send SIGTERM to all processes, allowing them to terminate gracefully.
 
| Send SIGTERM to all processes, allowing them to terminate gracefully.
 
|-
 
|-
| {{ic|Alt}}+{{ic|SysRq}}+{{ic|I}}+ '''Kill'''  
+
| {{ic|Alt+SysRq+i}} '''Kill'''  
 
| Send SIGKILL to all processes, forcing them to terminate immediately.
 
| Send SIGKILL to all processes, forcing them to terminate immediately.
 
|-
 
|-
| {{ic|Alt}}+{{ic|SysRq}}+{{ic|S}}+ '''Sync'''  
+
| {{ic|Alt+SysRq+s}} '''Sync'''  
 
| Flush data to disk.
 
| Flush data to disk.
 
|-
 
|-
| {{ic|Alt}}+{{ic|SysRq}}+{{ic|U}}+ '''Unmount'''  
+
| {{ic|Alt+SysRq+u}} '''Unmount'''  
 
| Unmount and remount all filesystems read-only.
 
| Unmount and remount all filesystems read-only.
 
|-
 
|-
| {{ic|Alt}}+{{ic|SysRq}}+{{ic|B}}+ '''Reboot'''
+
| {{ic|Alt+SysRq+b}} '''Reboot'''
 
| Reboot
 
| Reboot
 
|-
 
|-
 
|}
 
|}
 +
 +
{{Tip|
 +
* If you are using a [[display manager]] and after {{ic|Alt+SysRq+e}} you are presented with the login screen (or full desktop if autologin is enabled), it is most likely caused by {{ic|1=Restart=always}} directive in the relevant [[systemd|service file]]. If necessary, [[systemd#Editing provided units|edit the unit]], however this should not prevent the "REISUB" sequence from working.
 +
* If all the above combinations work except {{ic|Alt+SysRq+b}}, try using the contralateral {{ic|Alt}} key.
 +
* On laptops that use {{ic|Fn}} key to differentiate {{ic|SysRq}} from {{ic|PrtScrn}}, it may not actually be necessary to use the {{ic|Fn}} key (i.e., {{ic|Alt+PrtSc+''letter''}} could work).
 +
* You may need to press {{ic|Ctrl}} along with {{ic|Alt}}. So for example, full key shortcut would be {{ic|Ctrl+Alt+SysRq+b}}.
 +
}}
  
 
See [[wikipedia:Magic SysRq key|Magic SysRq key - Wikipedia]] for more details.
 
See [[wikipedia:Magic SysRq key|Magic SysRq key - Wikipedia]] for more details.
  
===Terminal===
+
=== Terminal ===
  
====Virtual console====
+
==== Virtual console ====
{|
+
 
|-
+
{| class="wikitable"
 
! Keyboard Shortcut
 
! Keyboard Shortcut
 
! Description
 
! Description
 
|-
 
|-
| {{ic|Ctrl}}+{{ic|Alt}}+{{ic|Del}}
+
| {{ic|Ctrl+Alt+Del}}
| Reboots Computer (specified by the symlink /usr/lib/systemd/system/ctrl-alt-del.target)
+
| Reboots Computer (specified by the symlink {{ic|/usr/lib/systemd/system/ctrl-alt-del.target}})
 
|-
 
|-
| {{ic|Alt}}+{{ic|F1}}, {{ic|F2}}, {{ic|F3}}, ...
+
| {{ic|Alt+F1}}, {{ic|F2}}, {{ic|F3}}, ...
| Switch to <i>n</i>-th virtual console
+
| Switch to ''n''-th virtual console
 
|-
 
|-
| {{ic|Alt}}+{{ic|&larr;}}
+
| {{ic|Alt+ &larr;}}
 
| Switch to previous virtual console
 
| Switch to previous virtual console
 
|-
 
|-
| {{ic|Alt}}+{{ic|&rarr;}}
+
| {{ic|Alt+ &rarr;}}
 
| Switch to next virtual console
 
| Switch to next virtual console
 
|-
 
|-
Line 63: Line 72:
 
| When Scroll Lock is activated, input/output is locked
 
| When Scroll Lock is activated, input/output is locked
 
|-
 
|-
| {{ic|&uArr; Shift}}+{{ic|PgUp}}/{{ic|PgDown}}
+
| {{ic|Shift+PgUp}}/{{ic|PgDown}}
 
| Scrolls console buffer up/down
 
| Scrolls console buffer up/down
 
|-
 
|-
| {{ic|Ctrl}}+{{ic|C}}
+
| {{ic|Ctrl+c}}
 
| Kills current task
 
| Kills current task
 
|-
 
|-
| {{ic|Ctrl}}+{{ic|D}}
+
| {{ic|Ctrl+d}}
 
| Inserts an EOF
 
| Inserts an EOF
 
|-
 
|-
| {{ic|Ctrl}}+{{ic|Z}}
+
| {{ic|Ctrl+z}}
 
| Pauses current Task
 
| Pauses current Task
 
|}
 
|}
  
====Readline====
+
==== Readline ====
  
GNU readline is a commonly used library for line-editing, it is used for example by bash, ftp and many more (see the details of {{Pkg|readline}} package under "Required By" for more examples). readline is also customizable (see manpage for details).
+
GNU readline is a commonly used library for line-editing; it is used for example by Bash, FTP, and many more (see the details of {{Pkg|readline}} package under "Required By" for more examples). readline is also customizable (see man page for details).
  
{|
+
{| class="wikitable"
|-
+
 
! Keyboard Shortcut
 
! Keyboard Shortcut
 
! Description
 
! Description
 
|-
 
|-
| {{ic|Ctrl}}+{{ic|L}}
+
| {{ic|Ctrl+l}}
 
| Clear the screen
 
| Clear the screen
 
|-  
 
|-  
| colspan=2 align="center" | Cursor Movement
+
| colspan=2 align="center" | '''Cursor Movement'''
 
|-
 
|-
| {{ic|Ctrl}}+{{ic|B}}
+
| {{ic|Ctrl+b}}
 
| Move cursor one character to the left
 
| Move cursor one character to the left
 
|-
 
|-
| {{ic|Ctrl}}+{{ic|F}}
+
| {{ic|Ctrl+f}}
 
| Move cursor one character to the right
 
| Move cursor one character to the right
 
|-
 
|-
| {{ic|Alt}}+{{ic|B}}
+
| {{ic|Alt+b}}
 
| Move cursor one word to the left
 
| Move cursor one word to the left
 
|-
 
|-
| {{ic|Alt}}+{{ic|F}}
+
| {{ic|Alt+f}}
 
| Move cursor one word to the right
 
| Move cursor one word to the right
 
|-
 
|-
| {{ic|Ctrl}}+{{ic|A}}
+
| {{ic|Ctrl+a}}
 
| Move cursor to start of the line
 
| Move cursor to start of the line
 
|-
 
|-
| {{ic|Ctrl}}+{{ic|E}}
+
| {{ic|Ctrl+e}}
 
| Move cursor to end of the line
 
| Move cursor to end of the line
 
|-
 
|-
| colspan=2 align="center" | Copy & Paste
+
| colspan=2 align="center" | '''Copy & Paste'''
 
|-
 
|-
| {{ic|Ctrl}}+{{ic|U}}
+
| {{ic|Ctrl+u}}
 
| Cut everything from line start to cursor
 
| Cut everything from line start to cursor
 
|-
 
|-
| {{ic|Ctrl}}+{{ic|K}}
+
| {{ic|Ctrl+k}}
 
| Cut everything from the cursor to end of the line
 
| Cut everything from the cursor to end of the line
 
|-
 
|-
| {{ic|Alt}}+{{ic|D}}
+
| {{ic|Alt+d}}
 
| Cut the current word after the cursor
 
| Cut the current word after the cursor
 
|-
 
|-
| {{ic|Ctrl}}+{{ic|W}}
+
| {{ic|Ctrl+w}}
 
| Cut the current word before the cursor
 
| Cut the current word before the cursor
 
|-
 
|-
| {{ic|Ctrl}}+{{ic|Y}}
+
| {{ic|Ctrl+y}}
 
| Paste the previous cut text
 
| Paste the previous cut text
 
|-
 
|-
| {{ic|Alt}}+{{ic|Y}}
+
| {{ic|Alt+y}}
 
| Paste the second latest cut text
 
| Paste the second latest cut text
 
|-
 
|-
| {{ic|Alt}}+{{ic|Ctrl}}+{{ic|Y}}
+
| {{ic|Alt+Ctrl+y}}
 
| Paste the first argument of the previous command
 
| Paste the first argument of the previous command
 
|-
 
|-
| {{ic|Alt}}+{{ic|.}}or{{ic|_}}
+
| {{ic|Alt+.}}/{{ic|_}}
 
| Paste the last argument of the previous command
 
| Paste the last argument of the previous command
 
|-
 
|-
| colspan=2 align="center" | History
+
| colspan=2 align="center" | '''History'''
 
|-
 
|-
| {{ic|Ctrl}}+{{ic|P}}
+
| {{ic|Ctrl+p}}
 
| Move to the previous line
 
| Move to the previous line
 
|-
 
|-
| {{ic|Altl}}+{{ic|N}}
+
| {{ic|Ctrl+n}}
 
| Move to the next line
 
| Move to the next line
 
|-
 
|-
| {{ic|Ctrl}}+{{ic|S}}
+
| {{ic|Ctrl+s}}
 
| Search
 
| Search
 
|-
 
|-
| {{ic|Ctrl}}+{{ic|R}}
+
| {{ic|Ctrl+r}}
 
| Reverse search
 
| Reverse search
 
|-
 
|-
| {{ic|Ctrl}}+{{ic|J}}
+
| {{ic|Ctrl+j}}
 
| End search
 
| End search
 
|-
 
|-
| {{ic|Ctrl}}+{{ic|G}}
+
| {{ic|Ctrl+g}}
 
| Abort search (restores original line)
 
| Abort search (restores original line)
 
|-
 
|-
| {{ic|Alt}}+{{ic|R}}
+
| {{ic|Alt+r}}
 
| Restores all changes made to line
 
| Restores all changes made to line
 
|-
 
|-
| colspan=2 align="center" | Completion
+
| colspan=2 align="center" | '''Completion'''
 
|-
 
|-
 
| {{ic|Tab}}
 
| {{ic|Tab}}
 
| Auto-complete a name
 
| Auto-complete a name
 
|-
 
|-
| {{ic|Altl}}+{{ic|?}}
+
| {{ic|Alt+?}}
 
| List all possible completions
 
| List all possible completions
 
|-
 
|-
| {{ic|Alt}}+{{ic|*}}
+
| {{ic|Alt+*}}
 
| Insert all possible completions
 
| Insert all possible completions
 
|-
 
|-
 
|}
 
|}
  
===X11===
+
=== X11 & Wayland ===
  
{|
+
{| class="wikitable"
|-
+
 
! Keyboard Shortcut
 
! Keyboard Shortcut
 
! Description
 
! Description
 +
! Notes
 
|-
 
|-
| {{ic|Ctrl}}+{{ic|Alt}}+{{ic|F1}}, {{ic|F2}}, {{ic|F3}}, ...
+
| {{ic|Ctrl+Alt+F1}}, {{ic|F2}}, {{ic|F3}}, ...
| Switch to <i>n</i>-th virtual console
+
| Switch to ''n''-th virtual console
 +
| If it does not work, try {{ic|Ctrl+Fn+Alt+F…}}.
 
|-
 
|-
| {{ic|Ctrl}}+{{ic|Alt}}+{{ic|+}}/{{ic|-}}
+
| {{ic|Shift+Insert}} <br> {{ic|Mouse Button 2}}
| Switch to higher/lower available resolutions
+
| Paste text from the [[Clipboard|PRIMARY buffer]]
|-
+
| By default, Qt maps {{ic|Shift+Insert}} to CLIPBOARD instead of the PRIMARY buffer (see e.g. [http://doc.qt.io/qt-5/qlineedit.html#details]).
| {{ic|Ctrl}}+{{ic|&uArr; Shift}}+{{ic|Num Lock}}
+
| Toggles keyboard mouse; uses numpad, mouse click is done by {{ic|5}}, use {{ic|/}}, {{ic|*}}, and {{ic|-}}to switch the click to left, middle, and right click
+
|-
+
| {{ic|Shift}}+{{ic|Insert}} <br> {{ic|Mouse Button 3}}
+
| Copy selected text to clipboard, or paste from clipboard
+
 
|-
 
|-
 
|}
 
|}
  
===Links===
+
== User customization ==
*[http://lnag.sourceforge.net/lnag_html/node5.html Linux Newbie Administrator Guide - Shortcuts and Commands]
+
 
*[http://tldp.org/HOWTO/Keyboard-and-Console-HOWTO.html The Linux keyboard and console HOWTO]
+
=== Readline ===
 +
 
 +
{{Merge|Readline|This section duplicates content of the main article.}}
  
==User Customization==
 
===Readline===
 
 
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.
 
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.
 
{{hc|.inputrc|
 
{{hc|.inputrc|
Line 205: Line 209:
 
}}
 
}}
  
===X11===
+
=== X11 ===
  
See [[Keyboard Configuration in Xorg#Frequently used XKB options]] for some common shortcuts, that are disabled by default.
+
See [[Keyboard configuration in Xorg#Frequently used XKB options]] for some common shortcuts, that are disabled by default.
  
See [[xmodmap]] for more extensive keyboard layout modifications.
+
=== Firefox ===
  
====Key binding for X-selection-paste====
+
Use the [https://addons.mozilla.org/en-us/firefox/addon/customizable-shortcuts/ customizable-shortcuts] add-on.
 +
 
 +
=== Key binding for X-selection-paste ===
 +
 
 +
{{Accuracy|1=The shortcuts presented here are mixed up or outdated: {{ic|F12}} in Firefox toggles the developer tools [https://support.mozilla.org/en-US/kb/keyboard-shortcuts-perform-firefox-tasks-quickly?redirectlocale=en-US&redirectslug=Keyboard+shortcuts#w_tools] and {{ic|Shift+Insert}} pastes the PRIMARY buffer.}}
  
 
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:
 
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:
Line 218: Line 226:
 
#Hit {{ic|F12}} to paste the buffer, instead of moving the mouse pointer to the field and center-click to paste.
 
#Hit {{ic|F12}} to paste the buffer, instead of moving the mouse pointer to the field and center-click to paste.
  
The method suggested here uses three packages available in the [[Official Repositories|official repositories]]:
+
{{Note|{{ic|Shift+Insert}} has a similar yet different functionality, see [[#X11]]: {{ic|Shift+Insert}} inserts the clipboard buffer, not the x-selection-paste buffer. In some applications, these two buffers are mirrored.}}
*{{Pkg|xsel}} to give access to the x-selection-buffer content.
+
 
*{{Pkg|xbindkeys}} to bind a key-stroke to an action.
+
The method suggested here uses three packages available in the [[official repositories]]:
*{{Pkg|xvkbd}} to pass the buffer string to the application by emulating keyboard input.
+
 
 +
* {{Pkg|xsel}} to give access to the x-selection-buffer content.
 +
* [[Xbindkeys]] to bind a key-stroke to an action.
 +
* {{Pkg|xvkbd}} to pass the buffer string to the application by emulating keyboard input.
  
 
This example binds the x-selection-paste operation to the {{ic|F12}} key:
 
This example binds the x-selection-paste operation to the {{ic|F12}} key:
 +
 
{{hc|.xbindkeysrc|
 
{{hc|.xbindkeysrc|
 
"xvkbd -no-jump-pointer -xsendevent -text "\D1`xsel`" 2>/dev/null"
 
"xvkbd -no-jump-pointer -xsendevent -text "\D1`xsel`" 2>/dev/null"
 
     F12
 
     F12
 
}}
 
}}
 +
 
The {{ic|"\D1"}} code prefixes a 100 ms pause to inserting the selection buffer (see the [http://homepage3.nifty.com/tsato/xvkbd/ xvkbd home page]).
 
The {{ic|"\D1"}} code prefixes a 100 ms pause to inserting the selection buffer (see the [http://homepage3.nifty.com/tsato/xvkbd/ xvkbd home page]).
 +
 
{{Note|Depending on your X configuration, you may need to drop the {{ic|-xsendevent}} argument to xvkbd.}}
 
{{Note|Depending on your X configuration, you may need to drop the {{ic|-xsendevent}} argument to xvkbd.}}
 
The key codes for keys other than {{ic|F12}} can be determined using {{ic|xbindkeys -k}}.
 
The key codes for keys other than {{ic|F12}} can be determined using {{ic|xbindkeys -k}}.
  
'''See Also:'''
+
'''References:'''
*[http://unix.stackexchange.com/questions/11889/pasting-x-selection-not-clipboard-contents-with-keyboard Pasting X selection (not clipboard) contents with keyboard]
+
* [http://unix.stackexchange.com/questions/11889/pasting-x-selection-not-clipboard-contents-with-keyboard Pasting X selection (not clipboard) contents with keyboard]
*[http://homepage3.nifty.com/tsato/xvkbd/ xvkbd home page]
+
* [http://homepage3.nifty.com/tsato/xvkbd/ xvkbd home page]
  
===Firefox===
+
'''XMonad Window Manager'''
Use the [https://addons.mozilla.org/en-us/firefox/addon/customizable-shortcuts/ customizable-shortcuts] add-on.
+
 
 +
In the {{Pkg|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 {{ic|Insert}} key) the following configuration can be used:
 +
{{hc|xmonad.hs|
 +
import XMonad.Util.Paste
 +
...
 +
  -- X-selection-paste buffer
 +
  , ((0,                    xK_Insert), pasteSelection) ]
 +
}}
 +
 
 +
'''Using xdotool''' - command-line X11 automation tool
 +
 
 +
With the {{Pkg|xdotool}} it 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:
 +
 
 +
<code>xdotool getwindowfocus key --window %1 click 2</code>
 +
 
 +
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 [[Window manager#Tiling_window_managers|tiling window manager]].
  
==Tips==
+
== See also ==
*If you like a keyboard-centered workflow, you might also appreciate a [[wikipedia:Tiling_window_manager|tiling window manager]], like [[Xmonad]].
+
* [https://www.kernel.org/doc/Documentation/sysrq.txt The Linux Magic System Request Key - Kernel documentation]
 +
* [http://lnag.sourceforge.net/lnag_html/node5.html Linux Newbie Administrator Guide - Shortcuts and Commands]
 +
* [http://tldp.org/HOWTO/Keyboard-and-Console-HOWTO.html The Linux keyboard and console HOWTO]

Latest revision as of 14:12, 16 July 2016

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

Standard shortcuts

Kernel

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 set kernel.sysrq = 1.

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
Tip:
  • 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).
  • You may need to press Ctrl along with Alt. So for example, full key shortcut would be Ctrl+Alt+SysRq+b.

See Magic SysRq key - Wikipedia for more details.

Terminal

Virtual console

Keyboard Shortcut Description
Ctrl+Alt+Del Reboots Computer (specified by the symlink /usr/lib/systemd/system/ctrl-alt-del.target)
Alt+F1, F2, F3, ... Switch to n-th virtual console
Alt+ ← Switch to previous virtual console
Alt+ → Switch to next virtual console
Scroll Lock When Scroll Lock is activated, input/output is locked
Shift+PgUp/PgDown Scrolls console buffer up/down
Ctrl+c Kills current task
Ctrl+d Inserts an EOF
Ctrl+z Pauses current Task

Readline

GNU 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 man page for details).

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
History
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
Completion
Tab Auto-complete a name
Alt+? List all possible completions
Alt+* Insert all possible completions

X11 & 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….
Shift+Insert
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]).

User customization

Readline

Merge-arrows-2.pngThis article or section is a candidate for merging with Readline.Merge-arrows-2.png

Notes: This section duplicates content of the main article. (Discuss in Talk:Keyboard shortcuts#)

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.

.inputrc
set editing-mode vi
set keymap vi-insert
"\C-r": history-search-backward
"\C-e": history-search-forward

X11

See Keyboard configuration in Xorg#Frequently used XKB options for some common shortcuts, that are disabled by default.

Firefox

Use the customizable-shortcuts add-on.

Key binding for X-selection-paste

Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: The shortcuts presented here are mixed up or outdated: F12 in Firefox toggles the developer tools [2] and Shift+Insert pastes the PRIMARY buffer. (Discuss in Talk:Keyboard shortcuts#)

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:

  1. In Firefox, select a string you want to google for (with the mouse).
  2. Hit Ctrl+k to enter the "Google search" field.
  3. Hit F12 to paste the buffer, instead of moving the mouse pointer to the field and center-click to paste.
Note: Shift+Insert has a similar yet different functionality, see #X11: Shift+Insert inserts 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:

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

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

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

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.

References:

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:

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

Using xdotool - command-line X11 automation tool

With the xdotool it 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

See also