Easy way to find SSH agent sockets on a system:

$ sudo cat /proc/*/environ | grep -Ehaoz "SSH_AUTH_SOCK=.+" 2>/dev/null | tr '\0' '\n' | sort -u

BTW this is one of the rare cases where the useless usage of cat | grep is legit ;-)

@emanuelduss Time for a very old grep trick?

sudo grep -Ehaoz "[S]SH_AUTH_SOCK=.+" /proc/*/environ 2>/dev/null | tr '\0' '\n' | sort -u

[S] will match a single S, so it will not match its own cmdline 😎​

@fdellwing Ooh, i saw that before on ps -ef usage, makes sense, thx for the hint!