Little lifehack for MacOS users.

Just add this code into your ~/.profile file and you will have terminal shortcut for copy into clipboard your SSH key.

alias ssh.key='cat ~/.ssh/id_rsa.pub | pbcopy; echo SSH PubKey copied to Clipboard'

After this you can use this alias as any program in terminal.

@dude /WWW# ssh.key
SSH PubKey copied to Clipboard
@dude /WWW# 

Enjoy!

PS: if you use any Linux/FreeBSD distributions and made same lifehack for them, you can share in comments your code. Cheers, dude.

Tagged with:
 

One Response to Copy your public SSH key to clipboard

  1. artoodetoo says:

    I can do on my Cygwin session in Windows:

    $ cp ~/.ssh/id_rsa.pub /dev/clipboard

    So, aliases are exist in cywin too :) Don’t be so boring apple-dude!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>