13. Copy, Paste, and Shorthand
Summer is here (at least for those of us in the Northern Hemisphere) and while our fascination of the PC will never pale, anything that requires a little less effort and energy is welcome. Hey, even penguins cut loose in the summer! Here's a little tip for Linux Explorers.

IMPORTANT: The tips in this document require the use command-line commands. For more information about how to read and execute Linux command-line prompts and commands, please check the Linux Clues' Linux Cheat Sheet, especially Linux Prompt Basics and Linux Command-Line Nomenclature.

Copy and Paste
If you thought copying and pasting in Windows was easy, you're going to love Linux. Ctrl-C and Ctrl-V may seem intuitive now -- but it probably took a while for them to become muscle memory. Yes, those same shortcuts work in Linux, but like a lot of tasks, Linux simplifies them further, particularly for those who don't enjoy keyboard shortcuts.

Use your cursor to select the text you want to copy. In Linux, that automatically copies the text to the clipboard. Next, navigate to wherever you wish to paste it (another program or desktop, to the console or terminal, etc.) Then push down and click the wheel on your wheel mouse to paste. On a three-button mouse without a wheel, just click the middle button to paste.

If your mouse is wheel-less and has only two buttons, then right-click the mouse. This brings up a contextual menu. Select paste and you're done.

Copying and pasting works this way with most mice, Linux distros, and applications, although we can't say it will always work. One exception is OpenOffice. Selecting text doesn't automatically copy it to the clipboard, so you'll have to select the text, then right-click and select copy from the menu. Then right-click again to paste.

Most distros also have a clipboard icon next to the clock (look for an orange icon with a K on it). It remembers the last five copied entries. Just click the icon to bring up a menu and select the entry you want to paste. Then click the wheel to paste it where you want it.

You can also configure the "K" to remember more than just the last five copies. Click the icon and select "Configure Clipper." In the dialog that appears, change the default "Clipboard History Size" to whatever setting you want, up to 25.

Bonus Tip: Copying Configuration Files
If you'd like to copy a full config file to a text file, a single command will do it. This comes in handy if you need another set of eyes to look over your Linux configuration and/or the file is too long to post in a support forum. By copying it to a text file, you can send it as an attachment to your favorite Linux expert.

We're using lilo.conf as our example. Copy the lilo.conf file to lilo.txt by typing this command on the console:

# cat /etc/lilo.conf >lilo.txt

The new Lilo.txt file will then be in your /home directory.

And, in case the crazy days of summer have melted some of your brain cells, here are a couple of quick shorthand tip reminders.

$ cd ..
What It Does: This is shorthand for go back one step in the directory tree (just like in DOS).

$ cd ~
What It Does: This is for /home/bruno; if you've got more than one user, then type cd ~bruno or cd ~anna.

$ cd ~/Downloads/Backgrounds
What It Does: This is for /home/bruno/Downloads/Backgrounds

For really fast typing don't forget the Tab key for auto-completion. We've put the following steps on multiple lines to make clearer what you're supposed to do; however, all the typing will actually appear on a single line on the computer screen.

At the $ prompt, type:


Then press Tab and type:


Then press Tab, followed by Enter.

Another way to represent this might be:

$ cd~/D{press Tab}/B{press Tab}{press Enter}

Pressing the Tab key saves some keystrokes by filling in the directory name. If you had more than one directory beginning with "D" (and yes Linux distinguishes between "D" and "d"), you'll be presented with all the options. The end result is the same as above: