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 output from a command 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

Copy the user input in the console into the system clipboard

$ xclip -i
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

Copied to clipboard
free 100$ digital ocean credit