xclip is a very useful tool that allow us to copy any output of a command (in the command line) to the clipboard. Let's see some examples:
You can use whichever command you want and also the content of a file:
$ sudo apt-get install xclip
We have to write our password and it will be installed. To prove it we are going to do an ls -a.
$ ls -a | xclip
To demostrate that it has been copied we can write the following command:
$ xclip -o
However if we want to copy it to our clipboard:
$ ls -a | xclip -sel clip
Now press Ctrl + V wherever you want!
You can use whichever command you want and also the content of a file:
xclip -sel clip < ~/carpeta/archivo
If it has been useful to you, share it!:)
Follow me on twitter for news: @Pirobtumen