- Unix and Linux shortcut keys
- Keyboard shortcut keys
- Command line shortcuts
- Keyboard shortcuts
- Contents
- Standard shortcuts
- Kernel (SysRq)
- Enabling
- Rebooting
- Killing a memory-hogging process
- Troubleshooting
- Linux console
- Xorg and Wayland
- Customization
- Readline
- sxhkd
- actkbd
- xbindkeys
- Desktop environments
- Window managers
- Key binding for X-selection-paste
- XMonad Window Manager
- Ubuntu Documentation
- Getting around the desktop
- Common editing shortcuts
- Capturing from the screen
- More Information
- See Also
Unix and Linux shortcut keys
Shortcuts are designed to help shorten the time required to perform frequently used commands or actions. In the sections below, we have listed keyboard shortcut keys that can be performed by pressing two or more keys at once. We have also listed command line shortcut keys that can be typed at the shell.
Keyboard shortcut keys
Not all of the following shortcut keys are universally compatible with every variant of Unix and Linux. Some of these shortcut keys are designed for use in a terminal environment, while others are for use in a desktop environment.
Ctrl + A | Moves the cursor to the beginning of the line. |
Ctrl + B | Moves the cursor backward one character. |
Ctrl + C | Cancels the currently running command. |
Ctrl + D | Logs out of the current session. |
Ctrl + E | Moves the cursor to the end of the line. |
Ctrl + F | Moves the cursor forward one character. |
Ctrl + H | Erase one character. Similar to pressing Backspace . |
Ctrl + P | Paste previous line(s). |
Ctrl + R | Allows you to search for a previously used command or switch. |
Ctrl + S | Stops all output on-screen (XOFF). |
Ctrl + Q | Turns all output stopped on-screen back on (XON). Also, closes an application window. |
Ctrl + U | Erases the complete line. |
Ctrl + W | Deletes the last word typed. For example, if you typed mv file1 file2, this shortcut would delete file2. |
Ctrl + Z | Cancels the current operation, moves back a directory or takes the current operation and moves it to the background. See bg command for additional information about background. |
Ctrl + Alt + D | Minimizes all application windows and shows the desktop. |
Ctrl + Alt + L | Locks the screen. |
Ctrl + Alt + T | Opens a new terminal window. |
Ctrl + Alt + ↑ / ↓ | Switches between workspaces (if you are a power user and use workspaces). |
Alt + F2 | Open the console to run a command (must be a power user). |
↑ / ↓ | Scroll through previously used commands. |
Command line shortcuts
You may find the following command line shortcuts helpful. You may also want to try using the alias command, which allows you to create shortcuts for long or frequently-used commands.
Not all of the following command line shortcuts are universally compatible with every variant of Unix and Linux.
Источник
Keyboard shortcuts
This article provides a list of (not commonly known) default keyboard shortcuts and provides information about user customization.
Contents
Standard shortcuts
Kernel (SysRq)
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).
Enabling
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.
Rebooting
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 |
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.
Troubleshooting
- 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 .
Linux console
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+Alt+Fn+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]) and Ctrl+Shift+Insert is mapped to the PRIMARY buffer. |
Customization
Readline
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). It has Emacs-like and vi-like editing modes which can be customized with escape sequences. Default key bindings are listed in readline(3) and the Info documentation.
Zsh uses ZLE to link shortcuts to widgets, scripts and commands.
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.
sxhkd
A simple X hotkey daemon with a powerful and compact configuration syntax. See sxhkd for details.
actkbd
actkbd AUR (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
xbindkeys allows advanced mapping of keysyms to actions independently of the Desktop Environment.
Desktop environments
Window managers
Key binding for X-selection-paste
The factual accuracy of this article or section is disputed.
This article or section needs expansion.
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).
- Hit Ctrl+k to enter the «search engine» field.
- Hit F9 to paste the buffer, instead of moving the mouse pointer to the field and middle-click to paste.
The method suggested here uses the following three packages::
- 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 F9 key:
The «\D1» code prefixes a 100 ms pause to inserting the selection buffer (see the xvkbd home page).
The key codes for keys other than F9 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:
Источник
Ubuntu Documentation
This page provides an overview of keyboard shortcuts that can help you use your desktop and applications more efficiently. If you cannot use a mouse or pointing device at all, see Keyboard navigation for more information on navigating user interfaces with only the keyboard.
Getting around the desktop
Switch between the Activities overview and desktop. In the overview, start typing to instantly search your applications, contacts, and documents.
Pop up command window (for quickly running commands).
Use the arrow keys to quickly access previously run commands.
Quickly switch between windows . Hold down Shift for reverse order.
Switch between windows from the same application, or from the selected application after Super + Tab .
This shortcut uses ` on US keyboards, where the ` key is above Tab . On all other keyboards, the shortcut is Super plus the key above Tab .
Switch between windows in the current workspace. Hold down Shift for reverse order.
Give keyboard focus to the top bar. In the Activities overview, switch keyboard focus between the top bar, dash, windows overview, applications list, and search field. Use the arrow keys to navigate.
Show the list of applications.
Super + Page Down
Shift + Super + Page Up
Shift + Super + Page Down
Shift + Super + в†ђ
Move the current window one monitor to the left.
Shift + Super + в†’
Move the current window one monitor to the right.
Ctrl + Alt + Delete
Show the notification list . Press Super + V again or Esc to close.
Common editing shortcuts
Select all text or items in a list.
Cut (remove) selected text or items and place it on the clipboard.
Copy selected text or items to the clipboard.
Paste the contents of the clipboard.
Undo the last action.
Capturing from the screen
Shift + Prnt Scrn
Take a screenshot of an area of the screen. The pointer changes to a crosshair. Click and drag to select an area.
Ctrl + Alt + Shift + R
More Information
See Also
- Keyboard navigation — Use applications and the desktop without a mouse.
- Set keyboard shortcuts — Define or change keyboard shortcuts in Keyboard settings.
- What is the Menu key? — The Menu key launches a context menu with the keyboard rather than with a right-click.
- What is the Super key? — The Super key opens the Activities overview. You can usually find it next to the Alt key on your keyboard.
You can choose the displayed language by adding a language suffix to the web address so it ends with e.g. .html.en or .html.de.
If the web address has no language suffix, the preferred language specified in your web browser’s settings is used. For your convenience:
[ Change to English Language | Change to Browser’s Preferred Language ]
The material in this document is available under a free license, see Legal for details.
For information on contributing see the Ubuntu Documentation Team wiki page. To report errors in this documentation, file a bug.
Источник