send ssh key to server ubuntu code example
Example 1: copy ssh keys
pbcopy < ~/.ssh/id_rsa.pub
Example 2: ubuntu create a ssh key
cat ~/.ssh/id_rsa.pub | ssh username@remote_host "mkdir -p ~/.ssh && touch ~/.ssh/authorized_keys && chmod -R go= ~/.ssh && cat >> ~/.ssh/authorized_keys"