wanting to copy something from command line or maybe a file you can use xclip
eg. copy your public ssh key from id_rsa.pub to clipboard directly from command line:
cat .ssh/id_rsa.pub | xclip -selection clipboard
or
cat .ssh/id_rsa.pub | xclip -selection c
source: http://askubuntu.com/questions/110347/command-line-clipboard-access