gpg - export all (private-)keys
Posted on Sat 04 May 2019 in Linux • 1 min read
GPG export
for keyid in $( gpg -K --with-colons | grep ^sec | cut -d: -f5 ); do \
[[ -d ~/.gnupg/export ]] || mkdir ~/.gnupg/export; \
gpg --export -a --export-options export-minimal --output ~/.gnupg/export/${keyid}.pub $keyid; \
gpg --export-secret-keys -a --output ~/.gnupg/export/${keyid}.key $keyid;
done
For a public key without signatures use --export-options export-minimal
!