How can the changes made to the hosts file in Linux take effect?

After modifying the hosts file in Linux, you can ensure its effectiveness by following these steps:

  1. Clear DNS cache: Enter the following command in the terminal to clear the DNS cache.
  2. Restart the NetworkManager service using systemctl command.
  3. Restart network service: Input the following command in the terminal to restart the network service.
  4. Restart the network using systemctl command.
  5. Reboot the computer: Execute the following command to restart the computer.
  6. Restart the system with superuser permissions.

Please note that in certain situations, operations may require root privileges. If you are not a root user, please prepend sudo before the command above.

Leave a Reply 0

Your email address will not be published. Required fields are marked *


广告
Closing in 10 seconds
bannerAds