Updated: 28 February 2025
Install xclip
sudo apt install xclip
Pipe command to primary (middle mouse button) clipboard
cmd | xclip
Pipe command to ‘clipboard’ clipboard, for pasting into another application
cmd | xclip -sel clip
Copy contents of file to clipboard, for pasting into another application
xclip -sel clip file.txt