$linuxjunkies
>

pi-hole(1)

Pi-hole is a network-wide DNS sinkhole and ad blocker that runs on Linux to block ads and malware domains.

UbuntuDebianFedoraArch

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

FlagWhat it does
-a, --adminAccess the web admin interface (typically on port 80 or 443)
-q, --queryQuery the gravity database for blocklists and domains
-g, --gravityUpdate gravity (download and compile blocklists)
-r, --restartRestart DNS and DHCP services
-l, --logsTail or view query logs
-u, --uninstallUninstall Pi-hole from the system
-v, --versionDisplay installed Pi-hole version
-d, --debugEnable debug mode for troubleshooting

Examples

Check the current Pi-hole version installed on your system

pihole -v

Update gravity database to download latest blocklists

pihole -g

Restart DNS services to apply configuration changes

pihole -r

Query gravity database to check if example.com is in any blocklist

pihole -q example.com

View live DNS query log in real-time

tail -f /var/log/pihole/pihole.log

Access the web dashboard API from the command line

curl http://127.0.0.1/admin

Enable debug mode to troubleshoot DNS resolution issues

pihole -d

Related commands