Flags, examples, and output format reference.
| Flag | Argument | Description | |
|---|---|---|---|
| ๐จ | -c | Force-enable ANSI color output. Auto-detected when stdout is a tty; NO_COLOR=1 disables it. | |
| ๐ | -d | PATTERN | Only show queries matching the domain pattern (substring or glob). E.g. -d amazonaws.com. |
| โฌ | -f | Flat output โ one line per query, no column alignment. Useful when piping to grep or awk. | |
| ๐ | -j | JSON output โ one JSON object per line (ndjson). Includes all fields: pid, name, type, query, answers, latency_ms. | |
| ๐ | -Q | Suppress error messages and warnings. Useful for long-running background use. | |
| ๐คซ | -q | Quiet โ show only the queried hostname, one per line. Useful for piping into sort | uniq. | |
| โฑ๏ธ | -t | Show timestamp for each query (RFC3339 format). Useful for correlating with other logs. | |
| ๐ฏ | -n | NAME[,NAME,...] | Only show queries from processes matching these names. Comma-separated or repeatable. |
| ๐ | -o | FILE | Append output to FILE instead of stdout. Colors are disabled for file output unless -c is also set. |
| ๐ฏ | -p | PID[,PID,...] | Only show queries from the given PIDs. Comma-separated list or repeatable. |
| ๐ค | -T | TYPE[,TYPE,...] | Filter by record type. E.g. -T A,AAAA or -T MX. Default: all types. |
Each DNS query/response produces one line. Fields are space-aligned for readability (use -f for flat output).
No flags โ shows every DNS query made by every process on the machine.
$ sudo proc-trace-dns 12341 curl A api.github.com โ 140.82.121.6 1.4ms 12342 python3 AAAA api.openai.com โ 2606:4700::6812 2.1ms 12343 node A registry.npmjs.org โ 104.16.0.35 1.7ms 12344 apt A deb.debian.org โ NXDOMAIN 0.5ms
Use -n to watch only a specific process. Accepts comma-separated names.
$ sudo proc-trace-dns -n curl,wget 19201 curl A example.com โ 93.184.216.34 1.2ms 19205 wget A releases.ubuntu.com โ 185.125.190.36 0.9ms
Use -d to surface only queries to a specific domain or subdomain.
$ sudo proc-trace-dns -d amazonaws.com 19305 python3 A s3.amazonaws.com โ 52.216.8.176 1.8ms 19307 java A kinesis.us-east-1.amazonaws.com โ 52.94.0.15 2.4ms
Pipe through grep to isolate failed lookups โ useful for finding misconfigured services.
$ sudo proc-trace-dns -Qf | grep NXDOMAIN
Use -j to emit ndjson โ pipe to jq, ship to Elasticsearch, or feed into any log pipeline.
$ sudo proc-trace-dns -j | jq . { "pid": 12341, "name": "curl", "type": "A", "query": "api.github.com", "answers": ["140.82.121.6"], "latency_ms": 1.4 }
Run a command and capture every DNS resolution it makes โ see exactly what it calls home to.
$ sudo proc-trace-dns -q -- bash install.sh 2>/dev/null | sort -u api.github.com cdn.segment.com objects.githubusercontent.com telemetry.vendor.io
Run in the background and log all queries for offline analysis.
$ sudo proc-trace-dns -Qt -o /var/log/dns-queries.log & [1] 9991