Skip to content

Instantly share code, notes, and snippets.

@dvdfreitag
Last active February 16, 2017 18:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dvdfreitag/0e656d81efea291761b3ed9fd5b6ee65 to your computer and use it in GitHub Desktop.
Save dvdfreitag/0e656d81efea291761b3ed9fd5b6ee65 to your computer and use it in GitHub Desktop.
Shell script to install the Zero Hosts hosts file to block ads.
# It should go without saying that this requires root. This can be run either on a host PC with
# the Android Debug Bridge (adb), or on the device itself in a terminal emulator (such as Termux).
# More information on the Zero Hosts file: http://someonewhocares.org/hosts/zero/
# Uncomment if you're using adb
# adb shell
su # switch to root
cd /storage/emulated/0 # change directory to the internal storage
wget http://someonewhocares.org/hosts/hosts # download the zero hosts file
mount -o rw,remount /system # mount /system as read/write
cat hosts >> /system/etc/hosts # append the zero hosts file to the system hosts file
rm hosts # delete the downloaded file
mount -o ro,remount /system # mount /system as read only
exit # exit root
exit # exit terminal
# Uncomment if you're using adb
# exit # exit adb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment