Skip to content

Instantly share code, notes, and snippets.

@nicolae-olariu
Forked from craigvantonder/flush-dns.sh
Created January 30, 2018 10:00
Show Gist options
  • Save nicolae-olariu/3731754a9a9f45aa975d97f22749d5c6 to your computer and use it in GitHub Desktop.
Save nicolae-olariu/3731754a9a9f45aa975d97f22749d5c6 to your computer and use it in GitHub Desktop.
Flushing the DNS in Ubuntu 16.04
#!/bin/bash
# NB: First install nscd with sudo apt-get install nscd
# run this command to flush dns cache:
sudo /etc/init.d/dns-clean restart
# or use:
sudo /etc/init.d/networking force-reload
# Flush nscd dns cache:
sudo /etc/init.d/nscd restart
# If you wanted to refresh your settings you could disable and then run
sudo service network-manager restart
echo "DNS Flushed!";
# Output:
# craig@laptop:~$ sh Desktop/Scripts/flush-dns.sh
# [sudo] password for craig:
# [ ok ] Reloading networking configuration (via systemctl): networking.service.
# [ ok ] Restarting nscd (via systemctl): nscd.service.
# DNS Flushed!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment