@sousvidal/dns-checker-cli
v1.0.0
Published
A CLI tool to check DNS records for a domain
Readme
dns-checker-cli
A fast, zero-config CLI tool for looking up DNS records of any domain. Queries all common record types in parallel and displays the results in a readable, color-coded table -- or as JSON for scripting.
Install
npm install -g dns-checker-cliOr run it directly without installing:
npx dns-checker-cli example.comUsage
dns-checker <domain> [options]Options
| Flag | Description |
| --- | --- |
| -t, --type <types> | Comma-separated record types to query (e.g. A,MX,TXT) |
| -j, --json | Output results as JSON |
| -s, --short | Compact output — skip record types with no results |
| -V, --version | Show version number |
| -h, --help | Show help |
Examples
Look up all DNS records for a domain:
dns-checker example.comQuery only specific record types:
dns-checker example.com --type A,MX,NSGet JSON output (useful for piping into jq or other tools):
dns-checker example.com --jsonSkip empty record types for a cleaner overview:
dns-checker example.com --shortCombine flags:
dns-checker example.com -t A,AAAA,MX -sSupported Record Types
| Type | Description |
| --- | --- |
| A | IPv4 addresses |
| AAAA | IPv6 addresses |
| CNAME | Canonical name (alias) |
| MX | Mail exchange servers (sorted by priority) |
| NS | Name servers |
| TXT | Text records (SPF, DKIM, domain verification, etc.) |
| SOA | Start of authority |
| CAA | Certificate authority authorization |
| SRV | Service locator records |
By default, all types are queried. Use --type to limit the query to specific types.
JSON Output
When using --json, the output structure is:
{
"domain": "example.com",
"results": [
{
"type": "A",
"records": ["93.184.216.34"]
},
{
"type": "MX",
"records": ["10 mail.example.com"]
}
]
}Records that failed to resolve will include an error field:
{
"type": "SRV",
"records": [],
"error": "querySrv ENODATA example.com"
}Development
# Install dependencies
npm install
# Run in development mode
npm run dev -- example.com
# Build for distribution
npm run build
# Lint
npm run lintProject Structure
src/
├── index.ts # CLI entry point (argument parsing, orchestration)
├── dns.ts # DNS resolution logic (parallel queries via node:dns)
├── formatter.ts # Output formatting (table and JSON)
└── types.ts # Shared type definitionsRequirements
- Node.js >= 18
License
MIT
