XCLIP utility to use the clipboard in the terminal

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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s