Linux 下更新 Host

文章目录

  • 更新Host


  • Linux 下更新 Host

Linux下下载github代码,经常超时,有时候可通过更新host来解决。以下梳理总结几种更新 host的方法。


更新Host

#方法一(openwrt,也利用于linux)
wget -q https://gitlab.com/ineo6/hosts/-/raw/master/next-hosts -O /tmp/new.txt --no-check-certificate
cat /tmp/new.txt /etc/hosts > /tmp/new1.txt
cp /tmp/new1.txt /etc/hosts
chmod 664 /etc/hosts
/etc/init.d/dnsmasq restart	#仅wrt需要

#方法二:
sudo sed -i '/github/d' /etc/hosts
sudo bash -c "curl https://gitlab.com/ineo6/hosts/-/raw/master/next-hosts | grep github >> /etc/hosts"

The End.


你可能感兴趣的:(OpenWRT,linux,服务器,智能路由器,Openwrt,Hosts)