hosts怎么恢复为默认内容?
hosts默认的内容被抹除,怎么恢复为默认内容?
设备:MacBook Pro
系统:macOS Monterey 12.0.1
MacBook Pro 15″, macOS 12.0
hosts默认的内容被抹除,怎么恢复为默认内容?
设备:MacBook Pro
系统:macOS Monterey 12.0.1
MacBook Pro 15″, macOS 12.0
两条命令:
1》将下面的全部复制并粘贴到一个新的终端窗口中,回车确认后,按照提示输入管理员密码,输入过程中光标不会移动,输入完成后回车确认。
sudo cat <<EOF > A.txt; ls -la A.txt
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
EOF
2》再运行下面的命令:
sudo chown root:wheel /etc/hosts; sudo chmod 644 /etc/hosts
感谢,这个答案很精彩。
命令行的优点就是 直接准确快捷可重复 😀
hosts怎么恢复为默认内容?