Sunday, October 12, 2008

10 keyboard shortcuts to improve your Linux experience

(link)
A few simple keyboard shortcuts can make your work in Linux far more efficient. Jack Wallen runs through 10 of his favorites, for both desktop environments and window managers.

Many Linux users are keyboard cowboys, breaking out in a cold, cold sweat when their nimble fingers have to leave the keyboard for the mouse. But even if you’re not like that, you can still employ some of those fantastic keyboard shortcuts that help make Linux commuting efficient. To get you started, here are my 10 favorite Linux keyboard shortcuts. Disclaimer: Some of these shortcuts will be desktop environment- or window manager-specific.

Note: This information is also available as a PDF download.

1: Ctl + Alt + Backspace
Use this shortcut when X isn’t responding or a program has locked up your desktop and you can’t get anything to respond. This combination instantly logs you out of X, taking you back to the login screen. It works with all desktop environments and window managers.

2: Ctrl + Alt + Delete
This is the big kahuna. If all else fails and you just need to reboot, you can hit this combination to instantly start the reboot process. All data will be lost, so use it wisely. This combination works in all desktop environments and all window managers.

3: Alt + Tab
This handy shortcut allows you to cycle through all open windows, stopping on the window you want to have focus. In other words, you don’t have to grab your mouse and click (or hover, depending upon your focus configuration) to give a window focus. To cycle through the windows, hold down the Alt key and then press the Tab key until you land on the window you want. This shortcut works in most desktop environments and window managers.

4: Ctrl + Alt + F*
This is one of those mack-daddy shortcuts you very well might need to use. It switches to various virtual terminals. The default terminal you’re working in is 6. So you can switch to another terminal by holding down Ctrl + Alt and hitting F1, F2, F3, F4, F5, F7, etc. Now these are virtual terminals, so if you already have a graphical interface going, you’ll only be able to work in a text-based terminal window. This is really good for debugging problems with the desktop or killing frozen applications when you don’t want to kill X completely.
(My note: At least in Ubuntu, with Ctrl + Alt + F7 you can return to the X environment from any of the virtual terminals. The virtual terminals are only from F1 to F6. The F8 shows you the last messages before going into X.)

5: Alt + Arrow key
If you’re using Linux, you probably know about the pager that allows you to have multiple desktops at one time. Instead of having to move your mouse to the edge of a screen, you can hit Alt and either the left or right arrow key to move from one desktop to another. This works in all desktop environments and window managers.

The following apply only to terminal (aka console) windows
6: Ctrl + a and Ctrl + e
If you are working in a text editor like Nano (from within a terminal window), you can get to the beginning of a line with Ctrl + a and the end of a line with Ctrl + e. These do not work in GUI applications. In a GUI application (such as OpenOffice), these combinations will work as they would in a normal desktop world. (For example, Ctrl + a will highlight all the text on a page.)

7: Ctrl + c
When you have a process running in a terminal window (say you’re following a process with the tail + f command), you can kill that process with the Ctrl + c combination.

8: Ctrl + z
This will zombie an application. If you have a process running in a terminal and you want the terminal back but don’t want to kill the application, you can hit Ctrl + z to send the process to the background. To get the process back, type fg.

9: Arrow up or Arrow down
The up or down arrow key, when in a terminal window, cycles through the history of commands you have issued in the terminal window. This is helpful for two reasons: You don’t have to retype commands all the time and you can more easily recall what commands have been run recently.

10: Ctrl + r
This is a handy command search tool. When you hit Ctrl + r, you are prompted to enter a character (or string of characters). You’ll have returned to you any previously issued command with that character or combination within. This is helpful because it does not discriminate between commands and switches. So if you can only remember a switch you used, you can enter that and the command will appear. When the command shows up you want, hit Enter to execute.
The keyboard advantage

These 10 simple Linux keyboard shortcuts will help you make your work in Linux far more efficient. Yes, there are plenty more beyond this list. Some shortcuts are specific to a particular environment, and many desktops or window managers allow you to create your own keyboard shortcuts. Use that feature, and you’ll find yourself working far more efficiently without having to move your hand from key to mouse and back.