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.