How to Copy and Paste in Terminal on Mac

How to Copy and Paste in Terminal on Mac

Mac Terminal looks intimidating at first, but copying and pasting inside it — and between it and the rest of your Mac — follows a handful of predictable rules. Once you know them, you will stop losing work to the single-item clipboard limitation and start moving text between your shell and your apps without thinking.

The Basic Keyboard Shortcuts in Terminal

Inside a standard Terminal window (or iTerm2, Warp, or any other macOS terminal emulator), the shortcuts are almost identical to the rest of macOS:

Action Shortcut
Copy selected text Cmd+C
Paste at cursor Cmd+V
Cut (in editable prompts) Cmd+X

You cannot use Ctrl+C to copy in Terminal — that key combination sends a SIGINT signal that interrupts the running process. Always use Cmd.

Selecting Text in Terminal

Before you copy, you need a selection. Three ways to do it:

  1. Click and drag over any text in the Terminal window.
  2. Double-click a word to select it, or triple-click to select an entire line of output.
  3. Hold Shift and use the arrow keys or click to extend a selection.

Once highlighted, Cmd+C copies it to the macOS clipboard.

pbcopy and pbpaste: The Power Tools

The macOS clipboard is accessible from the shell through two built-in commands: pbcopy and pbpaste. These pipe text directly to and from the system clipboard without any visual selection required.

Copy command output to the clipboard:

cat some-file.txt | pbcopy
echo "Hello" | pbcopy
pwd | pbcopy

After any of these, Cmd+V pastes the result anywhere on your Mac — a text editor, a Slack message, a browser address bar.

Paste clipboard contents into a command:

pbpaste > output.txt
pbpaste | grep "error"

This reads whatever is currently on the clipboard and sends it as input to the command. It is especially useful when you have copied a long URL, a JSON blob, or a list of file paths from somewhere else and want to process them in the shell.

Copy a file's content directly:

pbcopy < config.yaml

No cat needed — the redirect feeds the file into pbcopy.

Pasting Multi-Line Commands Safely

When you paste a multi-line block into Terminal, the shell may begin executing lines before you intended. Terminals that support Bracketed Paste Mode (most modern ones do) wrap pasted content in escape codes so the shell treats the whole block as a single unit rather than a stream of keypresses. If yours does not, paste one line at a time or use a script file instead.

The Clipboard Problem Terminal Exposes

Every time you copy something new in macOS, the previous item disappears. That is fine for a quick one-off paste, but Terminal work often involves copying multiple things in sequence — a file path, a command flag, an API key from a browser tab, a snippet from documentation. Switching windows repeatedly to re-copy something you had a moment ago is one of the small, constant friction points in developer workflows.

macOS does not natively save clipboard history. When the item is gone, it is gone.

How a Clipboard Manager Changes Terminal Work

A clipboard manager keeps every item you copy in an accessible history. Press a shortcut, search for what you need, and paste it — even if it was from three windows ago.

ClipHistory is a macOS clipboard manager built in Rust and Tauri, designed to stay out of the way until you need it. It captures everything you copy automatically and keeps the last 150 unpinned clips. Pinned clips are kept indefinitely with no limit.

Press Cmd+Shift+V from any app — including Terminal — to open your history. Type a few characters to search. Press Return to paste. The whole interaction takes about two seconds.

For Terminal-heavy work, a few features stand out:

Get ClipHistory — $19.99

That is a one-time annual license, not an auto-renewing subscription.

Quick Reference: Copying and Pasting in Terminal

Task How to do it
Copy selected terminal output Cmd+C
Paste into terminal Cmd+V
Copy command output to clipboard command | pbcopy
Paste clipboard into a command pbpaste | command
Copy a file to clipboard pbcopy < file.txt
Recall a previous clip Cmd+Shift+V (ClipHistory)

Summary

Copying and pasting in Mac Terminal uses Cmd+C and Cmd+V for on-screen selection, and pbcopy/pbpaste for piping data to and from the clipboard programmatically. The biggest gap in the built-in experience is that macOS only holds one item at a time — anything you copied before is gone. A local clipboard manager fills that gap without adding complexity or sending your data anywhere.