All Modules / Module 7 / Lesson 2 of 4

Turning copy-paste into a workflow

4 minute read

Copy Any Output

The pipe symbol (|) sends the output of one command to another. Combined with pbcopy, you can copy anything.

Examples

1

Copy a file listing:

ls | pbcopy
2

Copy file contents:

cat myfile.txt | pbcopy
3

Copy your command history:

history | pbcopy

Key Takeaway

command | pbcopy copies the output of any command. Never manually select and copy Terminal text again.