Generating a new keypair with good key length:
ssh-keygen -b 4096 -t rsa -C "<some comment here, like platform, user or computer name>" -f ~/.ssh/id_rsa
Edit 24.07.2020: ed25519 keys
Funnily, as the article I’m going to link states, I did not know about ed25519 until yesterday. Key generated by the ed25519 algorithm are shorter and faster to create and validate (supposedly they are also more secure than the ones created by the above mentioned RSA, but I’ll leave that open as I haven’t researched it).
But specifically for copy pasting or reading authorized_keys files and such things, ed25519 generated keys are great. I’ll be using those for a bit and see how many of my systems’ openssh supports it. Although I am in good hope as the article states it’s been in openssh for 5 years.
Generate a ed25519 key like so:
$ ssh-keygen -t ed25519 -C "<comment>" -f ~/.ssh/id_eddsa
Read for yourself: How To Generate ed25519 SSH Key