pihole command lets you control, configure, and update your Pi-hole.
Press tab after writing
pihole to see the available options.
Control all PiHole specific functions!
Usage: pihole [options]
Add -h after -w (whitelist), -b (blacklist), -c (chronometer), or -a (admin) for more information on usage
-w, whitelist Whitelist domains
-b, blacklist Blacklist domains
-d, debug Start a debugging session if having trouble
-f, flush Flush the pihole.log file
-t, tail Output the last lines of the pihole.log file. Lines are appended as the file grows
-up, updatePihole Update Pi-hole
-r, reconfigure Reconfigure or Repair Pi-hole
-g, updateGravity Update the list of ad-serving domains
-c, chronometer Calculates stats and displays to an LCD
-h, help Show this help dialog
-v, version Show current versions
-q, query Query the adlists for a specific domain
Use pihole -q domain -exact if you want to see exact matches only
-l, logging Enable or Disable logging (pass 'on' or 'off')
-a, admin Admin webpage options
uninstall Uninstall Pi-Hole from your system :(!
status Is Pi-Hole Enabled or Disabled
enable Enable Pi-Hole DNS Blocking
disable Disable Pi-Hole DNS Blocking
Blocking can also be disabled only temporarily, e.g.,
pihole disable 5m - will disable blocking for 5 minutes
restartdns Restart dnsmasq
Whitelist or Blacklist A Domain
This is one of the most common things you might do with the
pihole command (see commonly whitelisted or blacklisted domains)
pihole -w spclient.wg.spotify.com
Blacklist Twitch (appending multiple domains to the command)
pihole -b api.mixpanel.com spade.twitch pubads.g.doubleclick.net sb.scorecardresearch.com
Debug Your Pi-hole Install
will run through some diagnostics and generate a unique token, which you can provide to the Pi-hole dev team if you need help.
When prompted, navigate to some troublesome sites, so the data is captured by the debugger.
Flushing The Log File
Depending on your system and how heavily your Pi-hole is used, you may want to flush the log throughout the day. By default, the log if flushed at the end of the day via
cron, but a very large log file can slow down the Web interface, so flushing it can be useful. Just run
Tailing The Log File
Pi-hole logs DNS queries by default (this can be turned off when installing). Watching this log file in real-time can be useful for debugging a problematic site. You can also use it purely for curiosity. Since you will see domain queries come up in real-time you can see what is happening on your network.
will start the log rolling. Press Control + c to stop viewing the log.
Interpreting The Log
The log file can be a bit confusing, so take a look at this article to help understand what you are looking at.
will update your Pi-hole to the latest version.
This command does a lot of the magic by downloading ad block lists from several sources and combining them into a single
gravity.list hosts file, which is used to block ads. Run it with
This will for a download of any updates from the third-party block lists that we source. By default, this command runs once a week via
cron, so there's no need to run it manually unless you want to get some updated lists or you run into a problem with the list.
This command will show you some real-time stats on the command line. It works if you have an LCD screen setup per above, but it also works over SSH if you just want to hop in and watch some formatted stats roll by (see also Logstalgia).
Ad List Query
This command is useful to find out what domain a list appears on. Since we don't control what the third-parties put on the block lists, you may find that a domain you normally visit stops working. If this is the case, you could run
pihole -q somedomain.com
and it will return the list the domain was originally found on. This proved useful a while back when the Mahakala list was adding apple.com and microsoft.com to their block list.
Use can use the
-exact flag to find an exact match, otherwise it will just search for your phrase, so
pihole -q hulu
will return any domain with hulu in it, and
pihole -q t2.hulu.com -exact
will only search for t2.hulu.com.
You can turn off logging:
pihole -l off
and turn it back on:
pihole -l on
This can be useful if you don't want queries logged for a certain time.
Administer The Web Interface
You will mainly use this command to set or reset a password for the interface (a default password is generated at install), but you can also use it to adjust the temperature unit.
Set A Web Interface Password
pihole -a -p somepassword
will set a new password for your admin interface.
pihole -a -p with no arguments to remove any previously set password.
Adjust The Temperature Unit
pihole -a -c
pihole -a -f
pihole -a -k
You can uninstall Pi-hole by running
You will have the option to choose which packages will be removed in case you use them for other services on your machine.
Enabling Or Disabling Pi-hole
You can disable Pi-hole using
but you can also pass a time argument to disable Pi-hole for a certain amount of time:
pihole disable 10m
will disable Pi-hole for 10 minutes. Please note that you may not see the effects unless you flush your cache. You can use
m for minutes or
s for seconds.
pihole disable 60s
will disable Pi-hole for sixty seconds.
Checking If Blocking Is Enabled
You can check the current status of Pi-hole using
You can restart the DNS server with
this will force a reload of
dnsmasq at which time it will also reload the config file and the hosts file.