Linux gpg Guide - ryzendew/Linux-Tips-and-Tricks GitHub Wiki
Linux gpg Guide
Complete beginner-friendly guide to gpg on Linux, covering Arch Linux, CachyOS, and other distributions including encryption, digital signatures, key management, and secure communication.
Table of Contents
gpg Installation
Install gpg
Arch/CachyOS:
# Install GnuPG
sudo pacman -S gnupg
Debian/Ubuntu:
sudo apt install gnupg
Fedora:
sudo dnf install gnupg
gpg Basics
Generate Key
Create keypair:
# Generate key
gpg --full-generate-key
# Follow prompts
List Keys
Show keys:
# List keys
gpg --list-keys
# Shows public keys
gpg --list-secret-keys
# Shows private keys
Key Management
Export Key
Export public key:
# Export public key
gpg --export -a "Your Name" > public.key
# -a = ASCII armor
Import Key
Import key:
# Import public key
gpg --import public.key
# Imports key
Encryption and Signing
Encrypt File
Encrypt file:
# Encrypt file
gpg -e -r "Recipient" file.txt
# -e = encrypt
# -r = recipient
Sign File
Sign file:
# Sign file
gpg --sign file.txt
# Creates file.txt.gpg
Troubleshooting
gpg Not Found
Check installation:
# Check gpg
which gpg
# Install if missing
sudo pacman -S gnupg
Summary
This guide covered gpg usage, encryption, signing, and key management for Arch Linux, CachyOS, and other distributions.
Next Steps
- Package Signing - Package verification
- Security Configuration - Security setup
- gpg Documentation:
man gpg
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.