- Unsupervised Learning
- Posts
- OS X: Manipulating the Clipboard via Command Line
OS X: Manipulating the Clipboard via Command Line
![appleunix](https://media.beehiiv.com/cdn-cgi/image/fit=scale-down,format=auto,onerror=redirect,quality=80/uploads/asset/file/52f27be2-20eb-48e1-908e-4af3328f57be/appleunix.jpeg)
So I somehow just found out that you can manipulate OS X’s clipboard via command line. The utility that does it is called pbcopy (and pbpaste).
[bash]echo “Lorem ipsum dolor sit amet” | pbcopy[/bash]
Now, go into any OS X application and perform the paste (⌘-v) command and you’ll have the content you placed there via command line. Or you can use the related pbpaste to output your content.
[bash]pbpaste (to wherever)[/bash]
![pbcopy](https://media.beehiiv.com/cdn-cgi/image/fit=scale-down,format=auto,onerror=redirect,quality=80/uploads/asset/file/c65a4e41-b1a4-4af6-ab90-c3647aadace3/screen_shot_2010_03_05_at_104211_am.png)