Last Updated: August 15, 2019
·
1.14K
· opetznick

Shortcut to copy string to clipboard via command line in osx

Simply add this to your .bashrc or .zshrc or whatever you prefer:

alias strtoclipboard="osascript -e 'set the clipboard to \"STRING TO CLIPBOARD\"'"

Then open a new shell and execute your new alias strtoclipboard. CMD+V should show STRING TO CLIPBOARD. Adjust it to your needs.

It's pretty neat lets say for passwords which can't be saved.

1 Response
Add your response

nice, thx!

over 1 year ago ·