how do I open the /etc/hosts file in text editor?

Asked by Teresa

I am doing a project for my class which asks to open the /etc/hosts file in a text editor and add a line to the end of the file and save it. Where do I find this file /etc/hosts? Thanks

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu gedit Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Teresa (traesa5115) said :
#1

I am working on Ubuntu 8.10. Thanks

Revision history for this message
Chris Polderman (chris-polderman) said :
#2

From a commandline shell, type:

sudo gedit /etc/hosts

If you do not have the graphical gnome or kde environment, use a text based editor like vi:

sudo vi /etc/hosts

Hopes this solves your problem.

Chris

Revision history for this message
Chris Polderman (chris-polderman) said :
#3

BTW: be careful what you add here because it can really mess up your networking...

Revision history for this message
Florian Diesch (diesch) said :
#4

If you install nautilus-gksu you can open a file as root in nautilus (Gnome's default file manager) by right clicking and selecting 'Open as root' (or something like that - I don't use English language settings).

Can you help with this problem?

Provide an answer of your own, or ask Teresa for more information if necessary.

To post a message you must log in.