Skip to content

Instantly share code, notes, and snippets.

@jukkatupamaki
Last active February 20, 2020 11:36
Show Gist options
  • Save jukkatupamaki/6290d9e2e05b4f3595353ba8619444a4 to your computer and use it in GitHub Desktop.
Save jukkatupamaki/6290d9e2e05b4f3595353ba8619444a4 to your computer and use it in GitHub Desktop.
MacOS command-line copy and paste

Commands:

  • pbcopy - Copy to clipboard
  • pbpaste - Paste from clipboard

Example: Pipe filenames to clipboard

$ ls -1 | pbcopy 

These commands are useful if copied text should be 100% the same as the output. Selecting and copying text in terminal always has more whitespace than needed or one or two characters are missing. So this is a perfect solution to avoid those.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment