Skip to content

Linux gpg Guide

Mattscreative edited this page Dec 5, 2025 · 2 revisions

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

  1. gpg Installation
  2. gpg Basics
  3. Key Management
  4. Encryption and Signing
  5. Troubleshooting

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


This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.

Clone this wiki locally