How to copy content to clipboard and Get content of clipboard on Bash

To get clipboard value

xclip -o -selection clipboard

To set content to clipboard

printf "something" | xclip -sel clip

e.g. type ctc and paste something what you want to set to clipboard then type enter and “EOT” and enter.

alias ctc="cat <<EOT | xclip -sel clip"

e.g. If you are on WSL, to Windows from WSL clipboard, as follows.

xclip -o -selection clipboard | clip.exe


Articles maybe related

Make more Powerful Bash command line with fzf


Close Menu