Copy and paste text from command line to X clipboard
Command-line program for getting and setting the contents of the X selection
xsel
$ echo 'hello world' | xsel -b
$ xsel -b
$ cat filename.txt | xsel -b
$ xsel -b | grep 'search term'
$ xsel -b -c