Copy to the global clipboard from the command line

Back to index
Date: 2021-05-27
Category: bash


It's possible to write to the global clipboard from the command line using xclip.

sudo apt install xclip

cat file.txt | xclip -selection clipboard

You can then paste this content using CTRL+V as usual.