How to use dig

Hackbydoing Academy tool guide · Network scanning & recon · free, no login

What dig is, in plain words

Dig asks the DNS system — the internet's phone book — what address or other record belongs to a name.

A working dig command

dig example.com MX

This asks the phone book for example.com's MX records, which name the servers that accept email for that domain.

Every piece of the command, explained

+shortPrint only the short answer, such as the address itself, without dig's usual long explanation around it.
-xReverse lookup: the next piece is an IP address, and dig asks which name belongs to that address, the opposite of the usual question.
@An address written right after an @ sign, like @192.168.99.53, says which DNS server to ask, instead of your machine's usual one — useful for comparing two phone books' answers.
record typeA word like MX, TXT or A after the name says which kind of record to ask for: MX for mail servers, TXT for text notes a domain publishes, A for the plain address. With no type, dig asks for the address.

Use it the legal way

Only run dig on systems you own or have explicit, written permission to test — at work that means a signed engagement, at home that means your own lab. Inside Hackbydoing Academy you practice on simulated networks and lab machines built for exactly this, where breaking things is the lesson and no one else's systems are involved. Learning how a tool works also teaches you what it looks like from the defender's chair: the logs it leaves, the traffic it makes, and the settings that shut it down.

✦ Practice dig hands-on in a guided lab

Reading about dig is step one. In the Academy you run it yourself, step by step, in guided labs on simulated networks — 185 rooms covering attack and defense, from your first scan to full operations, with a defender's debrief at the end of every room. Founding membership is $9.99/mo for the first 500 members.

Join Hackbydoing Academy →

Related tool guides

Free from the Hackbydoing Academy — learn cybersecurity by doing: real tools, guided labs, attack and defense, on simulated networks. More free material: Tool Guides index · Free Downloads Library · Hackbydoing Academy · Print this page (Ctrl/Cmd+P) for a clean paper copy.