How to view your SSH public key on Linux

September 12, 2023 / Tutorials

In this article, we will explain how to view your SSH public key on Linux. There are two methods for viewing your SSH public key in Linux-

  1. The first method is to use the cat command:
    1. Using the run command.
    2.  Execute the following command.
      cat ~/.ssh/id_rsa.pub

      The command will display your SSH key on your Linux machine without requiring your key authentication password.

  2. The second method involves using both the ssh-agent and ssh-add commands::
    1. Using the ssh-agent command.
    2. Run the following command.
      ssh-agent sh -c 'ssh-add; ssh-add -L'
    3. After successful authentication, your SSH public key will be displayed in the terminal.
    4. Copy and paste it where you need it.

In this way, you can view your SSH public key on Linux. For more information on Linux, visit our knowledge base section.

Spread the love