Skip to content

Instantly share code, notes, and snippets.

@Shujito
Created August 28, 2023 05:57
Show Gist options
  • Save Shujito/54abb1760eaae8d9c514a0ad010a295e to your computer and use it in GitHub Desktop.
Save Shujito/54abb1760eaae8d9c514a0ad010a295e to your computer and use it in GitHub Desktop.
Update/Restore unified hosts file.
if [ -s /etc/hosts.bak ]; then
echo '[ Restoring your original hosts file ]'
sudo mv /etc/hosts.bak /etc/hosts
echo '[ Done! ]'
else
echo '[ There is nothing to do... ]'
fi
if [ -s /etc/hosts ] && [ ! -s /etc/hosts.bak ]; then
echo '[ Backing up your original hosts file... ]'
sudo cp /etc/hosts /etc/hosts.bak
fi
TEMPHOSTS=temphosts.txt
cat /etc/hosts > $TEMPHOSTS
echo '[ Downloading unified hosts... ]'
curl -s https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling/hosts >> $TEMPHOSTS
#ls -hl $TEMPHOSTS
echo '[ Replacing hosts with new hosts file... ]'
sudo cp $TEMPHOSTS /etc/hosts
rm $TEMPHOSTS
echo '[ Done! ]'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment