Copaste
No account needed - YAY!
← Back to Blog

How to Copy and Paste in Terminal (Mac, Windows and Linux)

How to copy and paste in Terminal on Mac, Windows and Linux: the right shortcuts, why Ctrl+C doesn't copy, pbcopy, clip and xclip, and safer multi-line pastes.

How to Copy and Paste in Terminal (Mac, Windows and Linux)

You select an error message in your terminal, press Ctrl+C, switch to your browser and paste. Nothing. Worse, the command you were running just died. If you've ever wondered how to copy and paste in Terminal without killing a process or retyping a 60-character path, you're not alone. The terminal follows older rules than the rest of your desktop, and once you know them, it gets much easier.

Why Ctrl+C doesn't copy in a terminal

Long before graphical copy and paste existed, Ctrl+C in a terminal meant one thing: interrupt. It sends a signal to the running program telling it to stop. Shells and command-line tools still rely on that, so terminals can't just hand the shortcut over to the clipboard.

Each platform handles this in its own way:

  • macOS never had the conflict. Copy and paste use the ⌘ Command key, so Ctrl+C stays free to interrupt.
  • Linux terminals add Shift: Ctrl+Shift+C copies and Ctrl+Shift+V pastes.
  • Windows Terminal guesses what you meant. If text is selected, Ctrl+C copies it. If nothing is selected, it interrupts.

How to copy and paste in Terminal on Mac

In macOS Terminal, and in most third-party terminals like iTerm2, copy and paste work the same way as in every other app:

  • ⌘C copies the selected text.
  • ⌘V pastes at the cursor.
  • Ctrl+C still interrupts the running command, so you can't mix them up by accident.

Selecting text takes a little practice:

  • Drag to select any range.
  • Double-click to select a word, or triple-click to select a whole line.
  • Hold ⌥ Option while dragging to select a rectangular block, which is handy for one column of output.

Terminal also has a few lesser-known paste options in the Edit menu. Paste Escaped Text (⌃⌘V) escapes spaces and special characters as it pastes, which helps when you paste a file name like Client Work/brief.pdf into a command. Paste Selection (⇧⌘V) pastes whatever is selected in the window without touching your clipboard at all.

One shortcut worth learning: drag a file from Finder into a Terminal window and its full path is typed for you, already escaped. We cover more ways to do this in how to copy a file path on Mac.

How to copy and paste in Terminal on Windows

Windows 11 uses Windows Terminal by default, and it gives you several options:

  • Ctrl+C copies when text is selected and interrupts when it isn't.
  • Ctrl+V pastes.
  • Ctrl+Shift+C and Ctrl+Shift+V always copy and paste, whatever is selected. They're the safer habit if you switch between Windows and Linux.
  • Right-click copies the selection if there is one, and pastes if there isn't.

If you're still using the older console window (conhost), for example inside some legacy tools, select text with the mouse and press Enter or right-click to copy, then right-click to paste. You can turn on Ctrl+Shift+C/V in the window's Properties under the Options tab.

How to copy and paste in a Linux terminal

On most Linux desktops (GNOME Terminal, Konsole and others) it's:

  • Ctrl+Shift+C to copy
  • Ctrl+Shift+V to paste

Linux also has a second clipboard that catches people out: the primary selection. Whatever you highlight is instantly available, and a middle-click pastes it, with no copy shortcut at all. It's separate from the Ctrl+Shift+C clipboard. That's why "I copied it but pasted something else" happens so often on Linux.

Copy and paste from the command line itself

Sometimes you don't want to select anything. You want a command's output to go straight onto the clipboard, or you want to send the clipboard into a command. Every platform has a tool for this:

  • macOS: pbcopy and pbpaste. Try cat ~/.ssh/id_ed25519.pub | pbcopy to copy your public key, or pbpaste > notes.txt to save your clipboard to a file.
  • Windows: clip in Command Prompt (ipconfig | clip), or Set-Clipboard and Get-Clipboard in PowerShell. Inside WSL, clip.exe works too.
  • Linux: xclip -selection clipboard or xsel --clipboard on X11, and wl-copy / wl-paste on Wayland. You may need to install them first.

It's the most reliable way to copy long output without missing a line.

Paste safely: multi-line commands and hidden characters

Pasting into a terminal is riskier than pasting into a document, because a terminal can run what you paste. A few habits worth building:

  • Watch for multi-line pastes. Text with a line break at the end can run as soon as it lands. Modern shells like zsh and recent bash use bracketed paste, which holds pasted text until you press Enter, and Windows Terminal warns you before a multi-line paste. Don't turn those safeguards off.
  • Be careful with commands from web pages. What you see in a browser isn't always what gets copied. Hidden text, smart quotes and odd characters can come along. If a command looks wrong after pasting, clear it and retype the suspicious part.
  • Strip the formatting. Rich text copied from docs or chat apps can carry curly quotes and non-breaking spaces that break commands in confusing ways. Pasting as plain text avoids it, and our guide on how to always paste as plain text shows how.
  • Mind your secrets. Tokens and passwords you copy stay on the clipboard until something replaces them. Clear them when you're done, especially on a shared screen.

Copying over SSH and inside tmux

Two situations confuse even experienced developers:

  • SSH sessions. Running pbcopy or xclip on a remote server puts text on that server's clipboard, not yours. Select text in your local terminal window instead, or use a terminal that supports the OSC 52 escape sequence, which lets remote programs write to your local clipboard.
  • tmux and screen. These have their own copy mode and buffer. In tmux, press your prefix and [ to enter copy mode. Some setups also need a modifier key (often Shift on Linux or ⌥ Option on Mac) to make a normal mouse selection work.

The real problem: the terminal clipboard holds one thing

Once your shortcuts work, you hit the next wall. A typical session goes something like this: copy an error, copy a commit hash, copy a path, then realize you need the error again. It's gone, because your clipboard only ever holds the last thing you copied.

macOS 26 Tahoe now includes a basic clipboard history in Spotlight (press ⌘Space, then ⌘4). It's useful in a pinch, but items expire after about eight hours, it's Mac-only, and you can't organize anything. Windows has Win+V, which also has limits.

If the terminal is where you spend your day, a proper clipboard manager is worth it. Copaste keeps unlimited, searchable history of everything you copy, including text, images and files. You can pin the commands you run every week, like a deploy script, a Docker cleanup or a long kubectl context switch, so they're a keystroke away. You can paste as plain text when formatting would break a command. And the Chrome extension syncs your clipboard between desktop and browser, so a token you copy in the terminal can go straight into a web console.

Quick reference

  • Mac: ⌘C / ⌘V. Ctrl+C interrupts. pbcopy and pbpaste from the command line.
  • Windows Terminal: Ctrl+C copies a selection, otherwise interrupts. Ctrl+Shift+C/V always copy and paste. clip or Set-Clipboard from the command line.
  • Linux: Ctrl+Shift+C / Ctrl+Shift+V, plus middle-click for the primary selection. xclip, xsel or wl-copy from the command line.

Stop losing what you copy.

Copaste remembers everything — texts, images, files, passwords. Local-only, keyboard-first, always instant.