Is there an equivalent to the Windows Hosts file which pre-empts the DNS lookups from URL searches from a browser?
The Linux equivalent is the hosts
file located at /etc
(i.e. /etc/hosts
).
If you want to e.g. block Facebook, you can use a text editor such as Nano or Gedit to edit the file as superuser:
sudo gedit /etc/hosts
…and then add these lines in order to map the Facebook host to IPv4 0.0.0.0
and IPv6 ::0
:
0.0.0.0 facebook.com
::0 facebook.com
0.0.0.0 www.facebook.com
::0 www.facebook.com
In order for these changes to take effect, you have to either reboot the system or run this command:
pkill -HUP dnsmasq