How to Check SPF, DKIM, and DMARC Records Using Terminal Commands
Author: LaptopMarts.in
Published: July 2025
🔐 Why Email Authentication Matters
Email security is crucial in preventing phishing, spoofing, and unauthorised email usage. Three DNS-based technologies—SPF, DKIM, and DMARC—help protect your domain and build trust with email recipients.
In this quick guide, we’ll show you how to check these records for your domain using the terminal on Linux, macOS, or WSL on Windows.
🛠 Tools You’ll Use
-
dig
: DNS lookup tool to query TXT records. -
host
: Lightweight alternative for DNS lookups.
✅ 1. Check DMARC Record
Run the following command:
#dig _dmarc.example.com TXT +short
You’ll see output like:
"v=DMARC1; p=none; rua=mailto:reports@example.com"
This tells you the DMARC policy for handling unauthenticated mail.
✅ 2. Check SPF Record
Check your domain’s SPF (Sender Policy Framework):
#dig example.com TXT +short
You’ll see output like:
"v=spf1 include:_spf.google.com ~all"
This specifies which servers are allowed to send mail for your domain.
✅ 3. Check DKIM Record
If you’re using Google Workspace, the default DKIM selector is google
. Run:
dig google._domainkey.example.com TXT +short
You’ll see output like:
"v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4..."
🧪 Bonus: Use host
for Quick Checks