Your SSH public key is the part of a key pair you provide to a server or service to authorise access. This guide explains how to display an existing public key on Linux without replacing the key pair.
Method 1: read the public-key file
Open a terminal under the user account that owns the key. For an Ed25519 key in the usual location:
cat ~/.ssh/id_ed25519.pubFor an RSA key:
cat ~/.ssh/id_rsa.pubUse the actual path if you chose another filename. Copy the whole public-key line, beginning with the key type. The .pub file is the public key; the matching file without that suffix is the private key and must not be shared.
Method 2: list keys held by the SSH agent
If your session already has an SSH agent, display its loaded public keys:
ssh-add -LSeveral lines mean the agent holds several keys. The agent has no identities means none are loaded; a connection error means no agent is accessible to the session. You can still read a public-key file using the first method.
If the public-key file is missing
Check the correct user account and key location before creating anything. If you have the existing private key, OpenSSH can derive its public part:
ssh-keygen -y -f ~/.ssh/id_ed25519Replace the path as needed. Do not overwrite an existing key pair merely to view its public key. A passphrase protects the private key, and you may need it when deriving the public part.