beginor
6/22/2017 - 8:35 AM

Update host through shell.

Update host through shell.

# update hosts
echo "Start update hosts"
echo "Create a new host file"
touch hosts
echo "Done!"
echo "Update AD block hosts ..."
curl https://raw.githubusercontent.com/vokins/yhosts/master/hosts >> hosts
echo "Done!"
echo "Update Google hosts ..."
curl https://raw.githubusercontent.com/sy618/hosts/master/p >> hosts
echo "Done!"
echo "Update Youtube hosts ..."
curl https://raw.githubusercontent.com/sy618/hosts/master/y >> hosts
echo "Done!"
echo "Update FQ hosts ..."
curl https://raw.githubusercontent.com/racaljk/hosts/master/hosts >> hosts
echo "Done!"
echo "Start update your host file, please input your password:"
sudo mv /etc/hosts /etc/hosts_$(date +%Y%m%d)
echo "Current host is backup to /etc/hosts_$(date +%Y%m%d)"
sudo mv hosts /etc/hosts
echo "Host file update completed."