Keyboard Shortcuts
When you spend most of your computer time producing rather than consuming, there's a lot to be gained by reducing the number of times your hand has to move away from the keyboard (to the mouse).
This is a collection of keyboard shortcuts, available in GNU/Linux / Ubuntu / Gnome. As the system gets less similar to this configuration, naturally, fewer of the shortcuts will work.
In the following, C is the "Control" (or "CTRL") key, and A is the left "ALT" key. Some of these shortcuts might work with the right "ALT" key (a.k.a. "ALT GR"), but since I have a left "ALT" key on all of my keyboards, I haven't bothered to check.
The key referred to as SysRq ("System Request") might be called Print Screen (arbitrarily abbreviated), or they might be separate keys.
Gnome Shortcuts
The Ubuntu Desktop shortcut documentation provides a more complete list - this is just my personal selection.
Shortcut | Description |
---|---|
A-F1 | Open the "Applications" menu. From here, the arrow keys can be used to navigate submenus. |
A-F2 | Open the "Run Application" dialog. Provides auto-completion - on my System, A-F2+ "fir" + Enter launches firefox, which is much quicker than locating the Firefox entry in the Application menu. There is also a handy "list of known applications", which is filtered as you type. |
A-F5 | Unmaximise the current window. |
A-F7 | Move the current window with the arrow keys - with "Control" pressed for by-pixel precision. |
A-F8 | Resize the current window with the arrow keys - with "Shift" for resizing to line up with other windows / extend to the edge of the screen. |
A-F9 | Minimise the current window. |
A-F10 | Maximise the current window. |
C-A-d | Show desktop (i.e. minimise all windows) - this is a toggle, do it again to restore the windows. |
C-A-Delete | Open the "Shutdown" (/ Restart / Suspend / Hibernate) Dialog. |
C-A-l | Lock the screen (no questions asked). |
A-Space | Open the current window menu. |
A-F4 | Close current window. |
A-Tab | Switch current window via a popup. |
A-Escape | Switch current window (immediately, no popup). |
Print Screen | Take a screenshot of the entire screen. |
A-Print Screen | Take a screenshot of the current window. |
Kernel Shortcuts
Neatly, the GNU/Linux kernel provides a textual alternative to the default (and beautiful, when it works) graphical interface:
Shortcut | Description |
---|---|
C-A-F1, C-A-F2, ... C-A-F6 | Switch to text terminal1-6. These are available independently of whether the graphical interface is responding or not. This does not kill your graphical interface session- you can switch back to that interface using C-A-F7. |
C-A-F7 | Switch (back) to the Graphical interface (X/Gnome). This is good to know if you unintentionally press C-A-F1-6. |
C-A-F8 | Switch to the console log. This is where the Magic system request info-shortcuts log to ( C-A-SysRq-h prints help). |
A-Right / A-Left | Switch to the next / previous text terminal. This includes the 6 text terminals, the console log, and the graphical interface. |
The magic System Request Key
Very neatly, the GNU/Linux kernel provides the "magic SysRq key" (very well documented on wikipedia and kernel.org).
For these shortcuts, the left and right Alt keys are equivalent.
It is not strictly necessary to include the Control key in the shortcut, but this prevents the A-SysRq-combination from being interpreted as "take a screenshot". Seeing as A-SysRq is only part of the shortcut, and several shortcuts are often combined, this can produce quite a lot of screenshots on a system which is partially responsive.
Sysrq Actions
These actions are intended as final resorts to communicate with an unresponsive system. There is a recommended order for using them to safely reboot.
Shortcut | Description |
---|---|
C-A-SysRq-b | Reboot the system - should be issued as the last in the reisub action sequence. |
C-A-SysRq-c | Send SIGTERM to all processes except init(1) . |
C-A-SysRq-i | Send SIGKILL to all processes except init(1) . |
C-A-SysRq-k | Kill all programs on the current virtual console. |
C-A-SysRq-o | Shut the system down - should be issued as the last in the reisuo action sequence. |
C-A-SysRq-r |
Resets the keyboard mode to ASCII - useful when the X server is acting up. Keyboard mode: Raw vs. ASCII (XLATE) vs. UTF-8 (unicode) - see also the kbd_mode manpage and this HOWTO. |
C-A-SysRq-s | Sync all file systems - particularly important before b and o. |
C-A-SysRq-u | Remount all file systems read-only. |
Reisub Sequence
Shortcut | Description |
---|---|
C-M-Backspace | This used to be the shortcut for restarting the X server, but it has been disabled since Ubuntu 9.10. It was just too easy to do this by mistake. It can be reenabled, but unless your keyboard layout is strange enough to make C-A-SysRq-Something hard to hit, there is little reason to do so. |
C-A-SysRq-reisub |
This is the standard sequence when the system is unresponsive, and should be preferred over simply power cycling (if there is a "Reset" button on your computer, that counts as a power cycle) the system. This is simply the commands r, e, i, s, u, b one after another (see above). Mnemonic: "busier" backwards: un-R-aw t-E-rminate k-I-ll S-ync U-nmount re-B-oot |
Sysrq-info Requests
Shortcut | Description |
---|---|
C-A-SysRq-h | Print help about the magic system request key on the console log. |
C-A-SysRq-l | Print a stacktrace for all active CPUs on the console log. |
C-A-SysRq-m | Print memory info on the console log. |
C-A-SysRq-t | Print current tasks on the console log. |
C-A-SysRq-0-9 | Set the logging level - 0 logs only high-priority messages. |
Disabled magic Sysrq key (Circumventing)
It is possible to disable the magic system request key. If a system does not respond to these requests, it might be because the sysrq key is not enabled. An alternative is, from the console, as root:
echo h > /proc/sysrq-trigger
This cannot be disabled, but you do need root privileges to use it. If your graphical interface is unresponsive, this can be issued from one of the text terminals.