The hosts one-click Deployment Script under Linux Environment, @lstoars contribution; @fluviusmagnus provides an enhanced version.
Official website: https://github.com/racaljk/hosts/tree/master/hosts_tools
#!/bin/sh # # Script_tool_for_linux # use
command: ' sudo sh script_tool_for_linux.sh ' or
# ' su-c ' sh script_tool_for_linux.sh '
# to update your hosts file.
#
# warning:the Script CAN not replace others ' hosts rules.
# If You are have hosts rules provided by others, your may get conflict.
#
if [' Id-u '-eq 0]; then
curl-flo/tmp/fetchedhosts ' https://raw.githubusercontent.com/racaljk/hosts/ Master/hosts '
sed-i '/# Copyright (c) 2014/,/# Modified hosts end/d '/etc/hosts sed-i ' s/localhost/' hostname '
/g "/tmp/fetchedhosts
cat/tmp/fetchedhosts >>/etc/hosts
rm-f/tmp/fetchedhosts
Echo ' Success. '
else
Echo ' Permission denied, are you root? '
Fi