Well it’s nothing out of the ordinary but I was looking for this specially since the last post about creating SSH Keys.
In that case I need to copy my “~/.ssh/id_rsa.pub” contents into the textarea field of SSH Keys in GitHub so I could just open the file with GEditor or Sublime-Text but I want to be able to take contents from the terminal and put them directly into my clipboard to just use CTRL+V where I need.
In order to do this in Ubuntu just install xclip
sudo apt-get install xclip
XCLIP comes with a nice helpful ManPage (man xclip)
But I can show you the basics, when you pipe content with just xclip that content it can be accessed with the middle button of the mouse for example (by the way pipe it’s just pass the content in this case used with | ).
cat ~/.ssh/id_rsa.pub | xclip
But that’s not what I want because sometimes I am on my laptop and there is no middle mouse button. So use it with the parameters:
cat ~/.ssh/id_rsa.pub | xclip -selection clipboard
And now you can use that content with CTRL+V