xclip

xclip

TLDR

Copy the output from a command to the X11 primary selection area (clipboard)

>_ echo 123 | xclip
copy

Copy the output from a command to a given X11 selection area

>_ echo 123 | xclip -selection [primary|secondary|clipboard]
copy

Copy the contents of a file to the system clipboard, using short notation

>_ echo 123 | xclip -sel clip
copy

Copy the contents of a file into the system clipboard

>_ xclip -sel clip [input_file.txt]
copy

Copy the contents of a PNG image into the system clipboard (can be pasted in other programs correctly)

>_ xclip -sel clip -t image/png [input_file.png]
copy

Paste the contents of the X11 primary selection area to the console

>_ xclip -o
copy

Paste the contents of the system clipboard to the console

>_ xclip -o -sel clip
copy

Paste the contents of the system clipboard into a file

>_ xclip -o -sel clip > [output_file.txt]
copy

Copied to clipboard
free 100$ digital ocean credit