All Modules / Module 7 / Lesson 1 of 4

Letting the clipboard do the work

3 minute read

Module 7

Clipboard-Driven Workflows

What if you could run a complex command by just pasting something? The clipboard can do the heavy lifting for you. In this module, you'll learn to build workflows where Terminal pulls directly from your clipboard, saving command output to files, and creating one-line commands you can run repeatedly without editing.

Terminal Meets Your Clipboard

Your Mac's clipboard — what you copy and paste with Cmd + C and Cmd + V — can talk to Terminal.

This opens up powerful workflows where you can copy from anywhere and use it in Terminal, or copy Terminal output to use anywhere.

Two Commands

pbcopy

Copy to Clipboard

Takes input and puts it on your clipboard.

pbpaste

Paste from Clipboard

Outputs whatever's on your clipboard.

Try It

1

Copy your current folder path to clipboard:

pwd | pbcopy
2

Now paste it anywhere — TextEdit, an email, a message

Key Takeaway

pbcopy copies to clipboard, pbpaste pastes from clipboard. The pipe symbol (|) sends output from one command to another.