Open a terminal and enter the following:
ssh-keygen
This should then ask you what name you want to give it and a password (leave blank for no password).
If you want to specify the type of key then use the "-t" flag followed by one of the following:
You now have your ssh key, you will see two files "key" and "key.pub", the pub means it the public key and is the one you will need to use on whatever remote server or whatever you need it for. The other file is your private key and is the one you will need to use on your device, for instance:
ssh -i ~/.ssh/mykey root@192.168.1.60
If you want to copy the key from you .pub file then there are some tools you can use. xclip works okay on linux but I personally found it to hang after the command was ran. On OSX you can use a tool called pbcopy.
How I do it is neither of those, I utilize my most used program; Neovim. I have an alias set in my zshrc (should work in any rc) and will is kind of system agnostic, meaning it should work no matter your system.
alias cc='nvim -c %y -c q'
So to copy a files contents I run "cc file" and it opens neovim copies the entire file to my clipboard and closes in the blink of an eye.