Use the ssh-keygen command to generate a public and private SSH key pair. Run it without any arguments to accept default values or pass the -t and -b flags to set the algorithm (RSA) and key length.