To edit the /etc/resolv.conf file, you typically need superuser (root) privileges. Here’s how you can do it:
-
Open a Terminal.
-
Use a text editor with superuser privileges. For example, you can use
nanoorvim. Here’s how to do it withnano:sudo nano /etc/resolv.confOr with
vim:sudo vim /etc/resolv.conf -
Make your changes. You can add or modify nameserver entries. For example:
nameserver 8.8.8.8 nameserver 8.8.4.4 -
Save and exit:
- In
nano, pressCTRL + X, thenYto confirm, andEnterto save. - In
vim, pressEsc, type:wq, and hitEnter.
- In
Note:
Changes to /etc/resolv.conf may be overwritten by network management services (like NetworkManager) on reboot or when the network is restarted. To make persistent changes, consider configuring your network settings through those services.
If you have any further questions, feel free to ask!
