19
10 月
2023

替换linux hosts指定域名ip

覆盖ip

echo "127.0.5.1 www.hknaruto.com" > /etc/hosts

追加ip

echo "127.0.5.1 www.hknaruto.com" >> /etc/hosts
echo "127.0.5.1 www.hknaruto.com" | /etc/hosts

更换ip

  1. sed -i 's/[0-9\.]\+[ ]\+www.hknaruto.com/127.0.0.2 www.hknaruto.com/g' /etc/hosts
    替换www.hknaruto.com的ip改成127.0.0.2

You may also like...

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注