Difference between revisions of "Keyboard shortcuts"
m (anyone else knew shift-insert had the same effect? I have to find more complete overview of all these shortcuts) |
Kynikos.bot (talk | contribs) (wikify some external links, use https for archlinux.org) |
||
(43 intermediate revisions by 19 users not shown) | |||
Line 1: | Line 1: | ||
− | {{ | + | [[Category:Keyboards]] |
− | {{ | + | [[Category:X Server]] |
− | {{ | + | [[Category:Accessibility]] |
− | + | [[zh-CN:Keyboard Shortcuts]] | |
+ | {{Article summary start}} | ||
+ | {{Article summary text|Default keyboard shortcuts and user customizations.}} | ||
+ | {{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.conf}} and set 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"). | |
− | |||
− | |||
− | ==Terminal== | + | {| |
+ | ! Keyboard Shortcut | ||
+ | ! Description | ||
+ | |- | ||
+ | | {{keypress|Alt}}+{{keypress|SysRq}}+{{keypress|R}}+ '''Unraw''' | ||
+ | | Take control of keyboard back from X. | ||
+ | |- | ||
+ | | {{keypress|Alt}}+{{keypress|SysRq}}+{{keypress|E}}+ '''Terminate''' | ||
+ | | Send SIGTERM to all processes, allowing them to terminate gracefully. | ||
+ | |- | ||
+ | | {{keypress|Alt}}+{{keypress|SysRq}}+{{keypress|I}}+ '''Kill''' | ||
+ | | Send SIGKILL to all processes, forcing them to terminate immediately. | ||
+ | |- | ||
+ | | {{keypress|Alt}}+{{keypress|SysRq}}+{{keypress|S}}+ '''Sync''' | ||
+ | | Flush data to disk. | ||
+ | |- | ||
+ | | {{keypress|Alt}}+{{keypress|SysRq}}+{{keypress|U}}+ '''Unmount''' | ||
+ | | Unmount and remount all filesystems read-only. | ||
+ | |- | ||
+ | | {{keypress|Alt}}+{{keypress|SysRq}}+{{keypress|B}}+ '''Reboot''' | ||
+ | | Reboot | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | See [[wikipedia:Magic SysRq key|Magic SysRq key - Wikipedia]] for more details. | ||
+ | |||
+ | ===Terminal=== | ||
− | ===Virtual console=== | + | ====Virtual console==== |
{| | {| | ||
|- | |- | ||
Line 34: | Line 65: | ||
| {{keypress|⇑ Shift}}+{{keypress|PgUp}}/{{keypress|PgDown}} | | {{keypress|⇑ Shift}}+{{keypress|PgUp}}/{{keypress|PgDown}} | ||
| Scrolls console buffer up/down | | Scrolls console buffer up/down | ||
− | |||
− | |||
− | |||
|- | |- | ||
| {{keypress|Ctrl}}+{{keypress|C}} | | {{keypress|Ctrl}}+{{keypress|C}} | ||
Line 48: | Line 76: | ||
|} | |} | ||
− | ===Readline=== | + | ====Readline==== |
GNU readline is a commonly used library for line-editing, | GNU readline is a commonly used library for line-editing, | ||
− | it is used for example by bash | + | it is used for example by bash, ftp and many more (see [https://archlinux.org/packages/core/i686/readline/ Arch Package details] under "Required By" for more examples). |
readline is also customizable (see manpage for details). | readline is also customizable (see manpage for details). | ||
Line 58: | Line 86: | ||
! Keyboard Shortcut | ! Keyboard Shortcut | ||
! Description | ! Description | ||
+ | |- | ||
+ | | {{keypress|Ctrl}}+{{keypress|L}} | ||
+ | | Clear the screen | ||
|- | |- | ||
| colspan=2 align="center" | Cursor Movement | | colspan=2 align="center" | Cursor Movement | ||
Line 67: | Line 98: | ||
| Move cursor one character to the right | | Move cursor one character to the right | ||
|- | |- | ||
− | | {{keypress| | + | | {{keypress|Alt}}+{{keypress|B}} |
| Move cursor one word to the left | | Move cursor one word to the left | ||
|- | |- | ||
Line 84: | Line 115: | ||
| Cut everything from line start to cursor | | Cut everything from line start to cursor | ||
|- | |- | ||
− | | {{keypress| | + | | {{keypress|Ctrl}}+{{keypress|K}} |
| Cut everything from the cursor to end of the line | | Cut everything from the cursor to end of the line | ||
|- | |- | ||
Line 141: | Line 172: | ||
|} | |} | ||
− | + | ===X11=== | |
− | |||
− | ==X11== | ||
{| | {| | ||
Line 157: | Line 186: | ||
|- | |- | ||
| {{keypress|Ctrl}}+{{keypress|Alt}}+{{keypress|Backspace}} | | {{keypress|Ctrl}}+{{keypress|Alt}}+{{keypress|Backspace}} | ||
− | | Kills X-server | + | | Kills X-server (This may not work for recent updates.) |
|- | |- | ||
| {{keypress|Ctrl}}+{{keypress|⇑ Shift}}+{{keypress|Num Lock}} | | {{keypress|Ctrl}}+{{keypress|⇑ Shift}}+{{keypress|Num Lock}} | ||
| Toggles keyboard mouse; uses numpad, mouse click is done by {{keypress|5}}, use {{keypress|/}}, {{keypress|*}}, and {{keypress|-}}to switch the click to left, middle, and right click | | Toggles keyboard mouse; uses numpad, mouse click is done by {{keypress|5}}, use {{keypress|/}}, {{keypress|*}}, and {{keypress|-}}to switch the click to left, middle, and right click | ||
|- | |- | ||
− | | {{keypress|Shift}}+{{keypress|Insert}} | + | | {{keypress|Shift}}+{{keypress|Insert}} <br> {{keypress|Mouse Button 3}} |
| Copy selected text to clipboard, or paste from clipboard | | Copy selected text to clipboard, or paste from clipboard | ||
− | } | + | |- |
+ | |} | ||
− | ==Links== | + | xkeyboard-config disable keyboard mouse by default after the version 2.0.1.To enable it, changing the following line in {{ic|/usr/share/X11/xkb/symbols/pc}}: |
− | *[http:// | + | {{bc|key <NMLK> { [ Num_Lock ] }; }} |
+ | back to as it was in version 2.0.1: | ||
+ | {{bc|key <NMLK> { [ Num_Lock, Pointer_EnableKeys ] }; }} | ||
+ | |||
+ | ===Links=== | ||
+ | *[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] | *[http://tldp.org/HOWTO/Keyboard-and-Console-HOWTO.html The Linux keyboard and console HOWTO] | ||
+ | |||
+ | |||
+ | |||
+ | ==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. | ||
+ | {{hc|.inputrc| | ||
+ | set editing-mode vi | ||
+ | set keymap vi-insert | ||
+ | "\C-r": history-search-backward | ||
+ | "\C-e": history-search-forward | ||
+ | }} | ||
+ | |||
+ | ===X11=== | ||
+ | ====Modifying the Keyboard Layout==== | ||
+ | This example changes the CapsLock key to only activate caps lock when the Shift key is also pressed | ||
+ | {{hc|.xinitrc|2=xmodmap -e 'keycode 66 = NoSymbol Caps_Lock Caps_Lock'}} | ||
+ | The keycode of the CapsLock key can be found in the output of | ||
+ | {{ic|xmodmap -pk}} | ||
+ | |||
+ | ====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). | ||
+ | #Hit {{keypress|Ctrl+k}} to enter the "Google search" field. | ||
+ | #Hit {{keypress|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]]: | ||
+ | *{{Pkg|xsel}} to give access to the x-selection-buffer content. | ||
+ | *{{Pkg|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 {{keypress|F12}} key: | ||
+ | {{hc|.xbindkeysrc| | ||
+ | "xvkbd -no-jump-pointer -xsendevent -text "\D1`xsel`" 2>/dev/null" | ||
+ | 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]). | ||
+ | {{Note|Depending on your X configuration, you may need to drop the {{ic|-xsendevent}} argument to xvkbd.}} | ||
+ | The key codes for keys other than {{keypress|F12}} can be determined using {{ic|xbindkeys -k}}. | ||
+ | |||
+ | '''See Also:''' | ||
+ | *[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] | ||
+ | |||
+ | ===Firefox=== | ||
+ | Use the [https://addons.mozilla.org/en-us/firefox/addon/customizable-shortcuts/ customizable-shortcuts] add-on. | ||
+ | |||
+ | ==Tips== | ||
+ | *If you like a keyboard-centered workflow, you might also appreciate a [[wikipedia:Tiling_window_manager|tiling window manager]], like [[Xmonad]]. |
Revision as of 04:07, 3 December 2012
zh-CN:Keyboard Shortcuts Template:Article summary start Template:Article summary text Template:Article summary end
Contents
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 echo "1" > /proc/sys/kernel/sysrq
or if you wish to have it enabled during boot, edit /etc/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").
Keyboard Shortcut | Description |
---|---|
Template:Keypress+Template:Keypress+Template:Keypress+ Unraw | Take control of keyboard back from X. |
Template:Keypress+Template:Keypress+Template:Keypress+ Terminate | Send SIGTERM to all processes, allowing them to terminate gracefully. |
Template:Keypress+Template:Keypress+Template:Keypress+ Kill | Send SIGKILL to all processes, forcing them to terminate immediately. |
Template:Keypress+Template:Keypress+Template:Keypress+ Sync | Flush data to disk. |
Template:Keypress+Template:Keypress+Template:Keypress+ Unmount | Unmount and remount all filesystems read-only. |
Template:Keypress+Template:Keypress+Template:Keypress+ Reboot | Reboot |
See Magic SysRq key - Wikipedia for more details.
Terminal
Virtual console
Keyboard Shortcut | Description |
---|---|
Template:Keypress+Template:Keypress+Template:Keypress | Reboots Computer (specified in /etc/inittab) |
Template:Keypress+Template:Keypress, Template:Keypress, Template:Keypress, ... | Switch to n-th virtual console |
Template:Keypress+Template:Keypress | Switch to previous virtual console |
Template:Keypress+Template:Keypress | Switch to next virtual console |
Template:Keypress | When Scroll Lock is activated, input/output is locked |
Template:Keypress+Template:Keypress/Template:Keypress | Scrolls console buffer up/down |
Template:Keypress+Template:Keypress | Kills current task |
Template:Keypress+Template:Keypress | Inserts an EOF |
Template:Keypress+Template:Keypress | 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 Arch Package details under "Required By" for more examples). readline is also customizable (see manpage for details).
Keyboard Shortcut | Description |
---|---|
Template:Keypress+Template:Keypress | Clear the screen |
Cursor Movement | |
Template:Keypress+Template:Keypress | Move cursor one character to the left |
Template:Keypress+Template:Keypress | Move cursor one character to the right |
Template:Keypress+Template:Keypress | Move cursor one word to the left |
Template:Keypress+Template:Keypress | Move cursor one word to the right |
Template:Keypress+Template:Keypress | Move cursor to start of the line |
Template:Keypress+Template:Keypress | Move cursor to end of the line |
Copy & Paste | |
Template:Keypress+Template:Keypress | Cut everything from line start to cursor |
Template:Keypress+Template:Keypress | Cut everything from the cursor to end of the line |
Template:Keypress+Template:Keypress | Cut the current word after the cursor |
Template:Keypress+Template:Keypress | Cut the current word before the cursor |
Template:Keypress+Template:Keypress | Paste the previous cut text |
Template:Keypress+Template:Keypress | Paste the second latest cut text |
Template:Keypress+Template:Keypress+Template:Keypress | Paste the first argument of the previous command |
Template:Keypress+Template:KeypressorTemplate:Keypress | Paste the last argument of the previous command |
History | |
Template:Keypress+Template:Keypress | Move to the previous line |
Template:Keypress+Template:Keypress | Move to the next line |
Template:Keypress+Template:Keypress | Search |
Template:Keypress+Template:Keypress | Reverse search |
Template:Keypress+Template:Keypress | End search |
Template:Keypress+Template:Keypress | Abort search (restores original line) |
Template:Keypress+Template:Keypress | Restores all changes made to line |
Completion | |
Template:Keypress | Auto-complete a name |
Template:Keypress+Template:Keypress | List all possible completions |
Template:Keypress+Template:Keypress | Insert all possible completions |
X11
Keyboard Shortcut | Description |
---|---|
Template:Keypress+Template:Keypress+Template:Keypress, Template:Keypress, Template:Keypress, ... | Switch to n-th virtual console |
Template:Keypress+Template:Keypress+Template:Keypress/Template:Keypress | Switch to higher/lower available resolutions |
Template:Keypress+Template:Keypress+Template:Keypress | Kills X-server (This may not work for recent updates.) |
Template:Keypress+Template:Keypress+Template:Keypress | Toggles keyboard mouse; uses numpad, mouse click is done by Template:Keypress, use Template:Keypress, Template:Keypress, and Template:Keypressto switch the click to left, middle, and right click |
Template:Keypress+Template:Keypress Template:Keypress |
Copy selected text to clipboard, or paste from clipboard |
xkeyboard-config disable keyboard mouse by default after the version 2.0.1.To enable it, changing the following line in /usr/share/X11/xkb/symbols/pc
:
key <NMLK> { [ Num_Lock ] };
back to as it was in version 2.0.1:
key <NMLK> { [ Num_Lock, Pointer_EnableKeys ] };
Links
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.
.inputrc
set editing-mode vi set keymap vi-insert "\C-r": history-search-backward "\C-e": history-search-forward
X11
Modifying the Keyboard Layout
This example changes the CapsLock key to only activate caps lock when the Shift key is also pressed
.xinitrc
xmodmap -e 'keycode 66 = NoSymbol Caps_Lock Caps_Lock'
The keycode of the CapsLock key can be found in the output of
xmodmap -pk
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).
- Hit Template:Keypress to enter the "Google search" field.
- Hit Template:Keypress 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:
- 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 Template:Keypress 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).
-xsendevent
argument to xvkbd.The key codes for keys other than Template:Keypress can be determined using xbindkeys -k
.
See Also:
Firefox
Use the customizable-shortcuts add-on.
Tips
- If you like a keyboard-centered workflow, you might also appreciate a tiling window manager, like Xmonad.