xclipis for CLI Copy/Paste.
The following command
echo "foo" | xclip -selection clipboard
will copy “foo” to you clipboard. Try pasting it elsewhere. The
clipboard selection is the one used by Ctrl-C Ctrl-V commands. The default selection of
xclip is the one used when you select text in linux (
A shorter version would be:
echo "foo" | xclip -sel c
You can also send the contents of the current clipboard to the terminal (useful for piping).
xclip -sel c -out
xclip -sel c -o