I need to directly copy the terminal stdout to the clipboard on Mac. How would I do this?
Example:
echo sometext | copy_to_clipboard
or
echo sometext > /private/clipboard.txt
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.
Sign up to join this communityI need to directly copy the terminal stdout to the clipboard on Mac. How would I do this?
Example:
echo sometext | copy_to_clipboard
or
echo sometext > /private/clipboard.txt
Use pbcopy
:
echo foo | pbcopy
Also see man pbcopy
for info on it and pbpaste
.