How to use ssh-keygen to generate a new bit SSH key

Options

Use the -f <filename> option to specify the file name. you can also use the -f option to

Use -t option to select the algorithm to use. e.g . rsa, dsa, ecdsa or ed25519

Use the -b option to specify the key size. e.g. rsa key size can be 2048 or 4096

Use -c “Comment” to add the comment for a key file. (e.g. the -c value can be your email address)

1. Run the command below replacing:

ssh-keygen -t rsa -f ~/.ssh/your_sshkey_name -b 4096 -C your_email@youremail.com

2. Press enter

3. You will then be asked to enter a passphrase (password). The passphrase is used for encrypting the key so that it cannot be used even if someone obtains the private key file.

4. At this point, your SSH key should be ready for use, run the below to access the key folder, display it and copy it to use it on a platform that you needs it for:

cd ~/.ssh/

cat your_sshkey_name