Configuration of this file can be tedious and time-consuming:
http://www.makeuseof.com/tag/modify-man ... ile-linux/
Fortunately, there is a more efficient method available.
Code: Select all
git clone http://git.r-36.net/hosts-gen && cd hosts-gen
sudo make install
sudo cp examples/gethostszero /bin
sudo chmod 775 /bin/gethostszero
sudo /bin/gethostszero
sudo hosts-gen
To update the list, use:
Code: Select all
sudo gethostszero
sudo hosts-gen
To update the file automatically, a systemd timer could be used.
https://wiki.archlinux.org/index.php/Systemd/Timers
For this, create these two files:
/etc/systemd/system/hostszero.timer
Code: Select all
[Unit]
Description=Update /etc/hosts daily.
[Timer]
OnCalendar=daily
AccuracySec=1h
Persistent=true
[Install]
WantedBy=timers.target
Code: Select all
[Unit]
Description=Update /etc/hosts
[Service]
Type=oneshot
ExecStart=/bin/gethostszero
ExecStart=/bin/hosts-gen
Code: Select all
sudo systemctl enable hostszero.timer
Code: Select all
sudo systemctl disable hostszero.timer
Code: Select all
systemctl status hostszero.timer
Code: Select all
empty@TheLab:~$ systemctl status hostszero.timer
● hostszero.timer - Update /etc/hosts daily.
Loaded: loaded (/etc/systemd/system/hostszero.timer; enabled)
Active: active (waiting) since Sun 2016-07-24 18:00:27 BST; 2min 42s ago
empty@TheLab:~$
http://someonewhocares.org/hosts/zero/hosts