pi-hole(1)
Pi-hole is a network-wide DNS sinkhole and ad blocker that runs on Linux to block ads and malware domains.
Synopsis
pihole [OPTION] | gravity [OPTION] | dnsmasq [OPTION]Description
Pi-hole intercepts DNS queries at the network level, blocking requests to known ad and malware domains before they reach client devices. It functions as a DNS server replacement, typically deployed on a Raspberry Pi or small Linux server to protect all devices on the network.
The main components include the DNS server (dnsmasq), the gravity database for blocklist management, and a web dashboard for monitoring and configuration. Configuration is primarily done via the web interface or command-line utilities rather than direct command invocation.
Common options
| Flag | What it does |
|---|---|
-a, --admin | Access the web admin interface (typically on port 80 or 443) |
-q, --query | Query the gravity database for blocklists and domains |
-g, --gravity | Update gravity (download and compile blocklists) |
-r, --restart | Restart DNS and DHCP services |
-l, --logs | Tail or view query logs |
-u, --uninstall | Uninstall Pi-hole from the system |
-v, --version | Display installed Pi-hole version |
-d, --debug | Enable debug mode for troubleshooting |
Examples
Check the current Pi-hole version installed on your system
pihole -vUpdate gravity database to download latest blocklists
pihole -gRestart DNS services to apply configuration changes
pihole -rQuery gravity database to check if example.com is in any blocklist
pihole -q example.comView live DNS query log in real-time
tail -f /var/log/pihole/pihole.logAccess the web dashboard API from the command line
curl http://127.0.0.1/adminEnable debug mode to troubleshoot DNS resolution issues
pihole -d