适用于linux和类unix操作系统(macos)等。
1 | sed -i "" "/# GitHub520 Host Start/,/# Github520 Host End/d" /etc/hosts && curl https://raw.hellogithub.com/hosts | sudo tee -a /etc/hosts |
大部分情况下是直接生效,如未生效可尝试下面的办法,刷新 DNS:
Windows:在 CMD 窗口输入:
1 | ipconfig /flushdns |
Linux 命令:
1 | sudo nscd restart |
如报错则须安装:
1 | sudo apt install nscd 或 sudo /etc/init.d/nscd restart |
Mac 命令:
1 | sudo killall -HUP mDNSResponder |
ok.
一起学习,一起进步。