Copy and paste may be the most important computing technology of the past 30 years. That may sound odd, but just think how much you rely on it. Most of us use the Copy and Paste commands multiple times every day, probably hundreds of times per week, without even realizing it.
If we didn’t have copy and paste, vast amounts of work would have to be done from scratch, rather than starting from previous bits of text, graphics, or entire documents that just need minor modifications. It would also be far harder to share links to Web pages. Sure, there are share buttons now, but would Twitter and Facebook have gotten off the ground if everyone had to link to cat videos by hand?
Surprising as this may be, some people still don’t understand the basics. And many others are missing out on advanced techniques with copy and paste, not to mention related ways of moving data between documents and apps.
Cut, Copy, and Paste Basics
To understand what the Cut, Copy, and Paste commands do, you first must understand the concept of the clipboard, a virtual container that holds whatever data you copy or cut. Although the clipboard is generally invisible to the user, you can view its contents in the Finder — just choose Edit > Show Clipboard. A small window appears, displaying whatever text or image is currently on the clipboard.
Before you can use Copy or Cut, you must first select some data. That might be text ranging from a character to an entire book, an image or a portion of an image, a file in the Finder, a column of data in a spreadsheet, or a chunk of an audio recording. How you select varies with the situation and the data, but it usually involves clicking once, or clicking and dragging over an area. (Don’t forget the Command-A shortcut for Select All!) Once you have something selected, you can copy or cut it.
When you copy selected data, OS X duplicates it on the clipboard for later pasting. You might copy a street address to paste into a mapping app, copy a photo from Safari to share with a friend, or copy a file in order to move it to another folder.
Closely related to Copy is Cut, which combines the copy action with a delete action. When you cut selected data, it disappears from its original location and moves onto the clipboard. Cut is thus handy for rearranging things. For instance, if you’re writing a report, and you decide that you want to move a paragraph higher up, you can select that paragraph, cut it, and paste it in the new place.
How do you cut, copy, and paste? Once you select the content you wish to cut or copy, choose Edit > Cut or Edit > Copy. To paste the clipboard’s contents, make sure the destination document or folder is active, and then choose Edit > Paste.
But navigating to the menu bar every time you wish to cut, copy, or paste is mind-numbing. Every Mac user should memorize these commands’ keyboard shortcuts — invoking them should be as second-nature as typing:
- Cut: Command-X
- Copy: Command-C
- Paste: Command-V
Paste with Style, or Style with Paste
Copying and pasting of text is simple, but it can get tricky when font styles are involved. You won’t have any problems when copying from or pasting into a plain-text editor like BBEdit. But let’s say you copy some text from a Web page and paste it into Apple Mail — it will transfer the typeface, text color, and even background color! All this style info can be useful in some cases, but most of the time, you probably just want the text to take on the look of the text around it, or to use the app’s default style.
In most apps, the command to paste text without any additional formatting is Edit > Paste and Match Style (Command-Option-Shift-V). Some apps might call it Paste Text Only or Paste Without Formatting.
Unfortunately, not all apps have such a command, even when it might be useful. To work around that limitation, turn to utility software, which you may already own. Macro utilities like Keyboard Maestro, launchers like LaunchBar, and clipboard utilities like Copy’em Paste can all remove formatting from text when pasting. For more details on these and other clipboard-related tricks, see Joe Kissell’s “Take Control of Automating Your Mac.”
Some apps (like Pages, TextEdit, and Messages) let you do the opposite, and copy and paste not the actual characters but instead the style of the source text. This capability is less common, and the location of the necessary commands varies widely.
In Pages, for instance, the Format menu contains Copy Style and Paste Style commands. In TextEdit, they’re in Format > Fonts. And in Messages, they’re in the Edit menu. Happily, the keyboard shortcuts remain the same, at least in Apple’s apps: Command-Option-C for Copy Style and Command-Option-V for Paste Style.
OS X’s Little-Known Secondary Clipboard
Whenever you copy or cut something, the new data overwrites whatever is on the clipboard. That can be annoying at times, forcing you to shuttle back and forth to move discrete chunks of data between apps. We don’t want to get sidetracked away from our focus on built-in capabilities of OS X here, but know that if you want access to your clipboard history, all the utilities mentioned just above provide those feature as well. You won’t go wrong with any of them, and if you want to work with multiple named clipboards, Keyboard Maestro and Copy’em Paste can help.
However, back in OS X, there is a secondary clipboard that’s accessible only via keyboard shortcuts: Control-K performs a kill, while Control-Y does a yank.
“Kill” and “Yank” are odd terms, but they come from the venerable command-line Emacs text editor. In practice, Kill and Yank are largely equivalent to the Cut and Paste commands, but with a few differences. Most notably, they have their own clipboard, which is known as a “kill ring” in Emacs, so cutting something with Control-K doesn’t replace whatever is on the main system clipboard. This special keyboard is specific to each app, so it can’t be used to move text between apps, but is helpful for rearranging text within an app.
There are other notable differences. Unlike Command-X, if you press Control-K when no text is selected, it affects everything from the insertion point to the end of the paragraph. If you perform multiple kills with no text selected, each bit of killed text is appended to the kill ring, such that a yank pastes all of them back at once. Finally, when you paste with Control-Y, all styles are automatically stripped from the pasted text.
Kill and Yank work in most OS X apps, but not all, and only seemingly in text-editing areas. Plus, some apps, particularly word processors and text editors, implement the Kill and Yank keyboard shortcuts in slightly different ways. For instance, in BBEdit, they seem to use the system clipboard, so you can kill text with Control-K and then paste with Command-V. And in Nisus Writer Pro, Yank can paste the text in the kill ring multiple times no matter how it got there, and it pastes with styles.
Copy and Paste in the Finder
So far, we’ve focused on copying and pasting text, but many people don’t realize that you can also copy and paste files and folders in the Finder. Dragging is often easier, but there are situations where copy and paste can be more efficient.
To copy a file or folder, select it and choose Edit > Copy filename (Command-C). Make sure you’re selecting the icon and not text in its name. Using Shift-click or Command-click, you can select and then copy multiple items at once. Next, open the window showing your desired location and choose Edit > Paste (Command-V) to paste the items in that spot.
While you can’t use the Cut command on files or folders to move them, the Finder enhances the Paste command to enable you to move items instead of copying them. First, copy one or more items normally and, once you’ve navigated to the destination, press and hold the Option key, and then choose Edit > Move Item Here (it replaces Paste). The keyboard shortcut for Move Item Here is, unsurprisingly, Command-Option-V.
Remember, if you make a mistake and paste in the wrong place, regardless of whether you’re copying or moving the items, you can always press Command-Z to undo the action.
One final tweaky Finder tip. Sometimes you need to tell someone where to find a file or folder that’s nested deeply within the directory structure, such as this folder:
Rather than type all that, you can copy the item’s pathname. With a file or folder selected, press and hold the Option key and choose Edit > Copy filename as Pathname (Command-Option-C). This copies, as text, the full pathname to the file or folder.
If you’re copying a pathname to paste it into the Terminal app as part of a command line invocation, there’s an even better way to do so: just drag the item into the Terminal window. This approach has the added benefit of reformatting the pathname as necessary.
Copying from Safari
Although we’ve focused primarily on uses of copy and paste that work anywhere, many apps use the commands in particular ways as well. In particular, Web browsers make it possible to copy a variety of things. The details vary slightly between browsers, but in Safari, there are a few different things you can copy from a Web page:
- Destination URLs from hyperlinks
- Image URLs
Copying text works just as in any other app. However, for the other types of data, you need to Control-click (or right-click, or however you usually bring up a contextual menu) the link or image. Depending on what you’ve clicked, you can copy a URL or the entire image. (If you remember “The Power of Preview: Pulling Files into Preview” (25 February 2016), you can open a copied image in Preview by choosing File > New from Clipboard.)
Text Clippings and Drag-and-Drop
This tip doesn’t use the clipboard precisely, but it offers similar functionality. After selecting text in almost any OS X application, you can drag it to your Desktop to create a “text clipping” — a special sort of file that contains the selected text. Text clippings aren’t standard text files, and double-clicking them opens them directly within an unusual window in the Finder. You can’t edit a text clipping, but amusingly, you can select text in one clipping and drag it to the Desktop to create another clipping.
Creating a text clipping is like copying the text; to “paste” the text in a clipping, drag its icon from the Finder into an app’s window. In a sense, text clippings solve the problem of OS X having only a single clipboard, since you could make a number of text clippings, and then drag them in all at once. (You can select multiple clippings and drag them into a document simultaneously.)
Text clippings can contain either plain text or “rich text” in RTF format. Plain text clippings take on the formatting of the surrounding text when dragged into a document, whereas rich text clippings retain their styles.
Some text editors and word processors — like BBEdit and Nisus Writer Pro, though not TextEdit and Pages — can open text clippings as documents, but said documents are new, and there’s no way to save changes back to a clipping. You cannot edit a text clipping in any way.
But wait! If you just want to move some text from one document to another, or even from one app to another, you don’t have to create an intermediary text clipping. Instead, just select the text and drag from one window to the other. This drag-and-drop trick works with graphics too.
What if the document into which you want to drop isn’t visible, or even open? Try this excruciatingly neat set of steps:
- In an app like Safari, select some text and start dragging.
- Drag the text to the Dock icon of an app that accepts text drops, like TextEdit or Pages.
- Continue the drag (don’t let up on the mouse button) and pause while the Dock icon is highlighted; everything on the screen will disappear, except for smaller windows representing that app’s open windows and thumbnails at the bottom of the screen representing recent files.
- Continue the drag to one of the open documents or thumbnails, and once your pointer is over it, pause again. The screen returns to normal, and the document you paused over opens.
- Still continuing the drag, move the pointer to the top or bottom of the document to scroll within the document until you’ve located the spot where you want the dragged text to appear. (With your other hand, you can even use navigation keys like Page Up and Page Down at this point!)
- Once you’ve positioned the insertion point as desired, let up on the mouse button to “paste” the text in that location.
You can start a drag and then use the Command-Tab application switcher to switch between apps as well, but that approach doesn’t provide any way to select recently used documents that aren’t open, as dragging to the Dock does.
It’s Pasteboards All the Way Down — Text clippings and drag-and-drop don’t use the clipboard, but we mention them because they rely on the same underlying technology, which Apple calls “pasteboards.” In OS X, pasteboards are a standardized mechanism for exchanging data within an app or between apps. The clipboard is just one standard public pasteboard that all applications share; drag-and-drop operations use a different public clipboard, and the Kill and Yank commands presumably use yet another. Apple’s developer documentation about
pasteboards actually makes for some interesting reading.
While pasteboards are conceptually simple, implementing them well can be quite complex. For instance, different apps can handle various types of data, and it’s up to each app to put all the appropriate types of data on the shared pasteboard so as many other apps as possible can access it. That doesn’t always happen, so, for instance, you can drag a picture from Photos to Apple Mail, but you can’t drag one to Mailplane because Photos isn’t giving Mailplane a representation of the picture that Mailplane understands.
Should you want to connect clipboard data with Unix apps, check out the
pbpaste commands. Explaining how to use them is beyond the scope of this article, but you can start at their man pages.
Here’s a final bit of geeky trivia. Since you can copy data, quit the source app, launch the destination app, and then paste, it’s clear that copy and paste has to rely on yet another background app to work its magic. That pasteboard server process is called
pbs, so if you see it in Activity Monitor, you’ll know that it’s powering your clipboard and drag-and-drop, not prepping for the next pledge drive.
Needless to say, you don’t need to know anything about pasteboards, but it’s a testament to Apple’s OS X engineers that moving data between apps with copy and paste, text clippings, and drag-and-drop is so easy. Now let’s show our appreciation by putting these subtle features to use! And, of course, if you have any other clipboard- or pasteboard-related tips, let us know.