Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

How do I modify my hosts file?

user-image
Question added by Zaid Rabab'a , Software Development Team Leader , Al-Safa Co. Ltd.
Date Posted: 2013/12/10
Asif Ali M
by Asif Ali M , Project Lead , LiquidHub

you should have root access or you should be the sudo user to modify.

The default location of the file in linux is /etc/hosts to modify

 

open a terminal then type "sudo vi /etc/hosts"

 

sherin villannassery
by sherin villannassery , Software Engineer , Ti Technologies

The owner of a file/directory, use chown. For example:

sudo chown your_username file_or_directory

Check man chown and man chmod for more information.

But, be careful, it is not a good idea to became the owner of a system file/directory! So, if you want to edit a system file is not necessary to be the owner of that file. Just use in terminal:

sudo -i # to grant access as root gedit file_name # or /path/to/file/file_name

After you finished to edit your file, press Ctrl+D in terminal to exit from root session.

Clodelio Delfino
by Clodelio Delfino , Managing Consultant , Startup Company

in windows:

systems32/drivers/etc/host

 

in linux:

/etc/hosts

 

Any text editor will do the job as long as you have privilege or access to modify it. e.g. root, administrator.

for what purpose do you need to modify file.. there is a seperate files for each thing and it depends on linux flavor as well. more or else all of them has same file naming convention but you need to be specific about this your requirement. 

 

 

More Questions Like This

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.