Copy to clipboard on FreeBSD
September 25, 2023 —
Nico Cartron
As part of my transition from MacOS to FreeBSD, there's a bunch of things I need to adapt to/change.
One of them is using pbcopy
, which copies the output to MacOS' clipboard.
Of course it is possible to do it on *BSD (and I assume it should be the same on Linux) - I'm posting this mostly for me, as a way to document it, but as usual, hopefully it will be useful to others!
Here's the latest entry to my ~/.zsh_aliases
:
## Paste
alias pbcopy='xclip -selection clipboard'
Then next time you want something to be copied to your clipboard, you just need to type:
cat <myfile> | pbcopy
and the content of <myfile>
will be in your clipboard!