I am unable to access or write to etc/hosts file

I am attempting to edit theetc/hosts file. I am able to access it through the graphic file system to find that it is read only. When using sudo nano etc/hosts as many suggest, I see that the directory etc doesn’t exist although i can see it in the GUI, so I assume it is just creating a new file in a new directory rather than opening the existing one. I cannot even make /etc/ my working directory as if it does not exist. Both etc and hosts file exist I am just unable to access it through the terminal or edit it through the graphic interface.

I run into a similar issue when using chmod or chown, being told the file/directory does not exist.

I find the file in question under "other locations" in the file manager and was able to drag the /etc/ folder to my bookmarks thinking that would do something but it didnt. Is this a partition or mounting issue? I apologize if this is silly I am very new to ubuntu.

Thank you for any help

Asked By: hysiminai

||

You are missing a slash in the beginning of the filename … it should be
/etc/hosts …
The difference is that without the slash,the path/filename is relative to the directory you currently are in. WITH the slash
it is absolute from the top of the filesystem.

Answered By: Soren A
Categories: Answers Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.