Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How and where can I check what keys have been added with ssh-add to my ssh-agent ?

share|improve this question
up vote 76 down vote accepted

Use the -l option to ssh-add to list them by fingerprint.

$ ssh-add -l
2048 72:...:eb /home/gert/.ssh/mykey (RSA)

Or with -L to get the full key in OpenSSH format.

$ ssh-add -L
ssh-rsa AAAAB3NzaC1yc[...]B63SQ== /home/gert/.ssh/id_rsa

The latter format is the same as you would put them in a ~/.ssh/authorized_keys file.

share|improve this answer
[rahul@srv1~]$ ssh-add -l Could not open a connection to your authentication agent. – Rahul Patil Dec 20 '12 at 11:11
@RahulPatil Are you running an SSH agent on that machine? Run this on the same machine as to which you've added the keys, not the remote one! – gertvdijk Dec 20 '12 at 11:18
thanks my mistake – Rahul Patil Dec 20 '12 at 11:27
You could run this command on the remote host if key agent forwarding is enabled. – Patrick Mar 30 '13 at 19:58
Example: ssh-agent sh -c 'ssh-add; ssh-add -l' – kenorb Mar 26 '15 at 21:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.