Copy text to the clipboard by piping output to the platform’s clipboard command. Retrieve it with the corresponding paste command.

WSL

echo "hello" | clipcopy
clippaste

macOS

echo "hello" | pbcopy
pbpaste

Linux

echo "hello" | xclip -selection clipboard
xclip -selection clipboard -o

References:

  • https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/clipboard