Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,808,827 Members 54,564 Now Online
XDA Developers Android and Mobile Development Forum

Where is the Hosts File in Android?

Tip us?
Junior Member - OP
Thanks Meter 0
Posts: 5
Join Date: May 2009
Default Where is the Hosts File in Android?

In my country some sites have been banned but most of us keep using them in pc's by changing hosts file in \Windows\System32\drivers\etc

adding ip strings like

I just wonder if there is someway to do this in android? If the answer is yes then my new question is "how"...

Thx for the answers...
Senior Member
Thanks Meter 24
Posts: 100
Join Date: Nov 2008
The Following User Says Thank You to rub1k For This Useful Post: [ Click to Expand ]
Junior Member - OP
Thanks Meter 0
Posts: 5
Join Date: May 2009
Originally Posted by rub1k View Post

Thx. I reached the file by a file manager app. but i cant open it with notepad apps. Do I need the root privilage?
Recognized Developer
Thanks Meter 718
Posts: 853
Join Date: Jan 2007
yes. Just ADB pull it.
I do CyanogenMod stuff.

Circle me on Google+
grokdesigns's Avatar
Senior Member
Thanks Meter 4
Posts: 194
Join Date: Jul 2007
Location: Chandler, AZ
Technically it's in /system/etc/hosts, /etc is a symlink.

If you want to edit it, create a hosts file on your SD card and then cp from terminal with root privileges. Or you could adb push it from your computer.
HTC Thunderbolt
Junior Member - OP
Thanks Meter 0
Posts: 5
Join Date: May 2009
thx a lot for the answers. ill try it.
Junior Member
Thanks Meter 0
Posts: 1
Join Date: Apr 2010
Default question

hello there,

i'm a newbie and i don't know anything about programming. and i need a step by step guide to edit the host file. i have reached the file with file manager but i can't edit or replace it.

(Last edited by gophergun; 18th April 2010 at 10:22 AM.)
Senior Member
Thanks Meter 2
Posts: 311
Join Date: Feb 2008
Should just be a matter of

adb pull /etc/hosts

Which will copy the file to the current directory, then make the necessary changes, then

adb remount
adb push hosts /etc/hosts

Anyone correct me if I'm wrong. If you don't have ADB set up, now would be a good time to do so; searching for "ADB for dummies" should help you with that.
cloverdale's Avatar
Senior Member
Thanks Meter 147
Posts: 1,597
Join Date: Feb 2009
Location: Washington DC
Default Re: Where is the Hosts File in Android?

I suggest nano if you have a ROM with this included (such as cyanogenmod). Then all you need to do is open the terminal and enter
nano /system/etc/hosts
In this manner, one can do the edits straight from the phone terminal.
Empirical evidence can never establish mathematical existence - nor can the mathematician's demand for existence be dismissed by the physicist as useless rigor. Only a mathematical existence proof can ensure that the mathematical description of a physical phenomenon is meaningful.
-- Richard Courant
domenukk's Avatar
Senior Member
Thanks Meter 24
Posts: 807
Join Date: Jan 2010
Or download estrongs file manager, go to settings and set file system to "read write"(its in something like root settings or so). after that you can edit the file

ban, ban ip, hosts
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Jair Player with a Major Update–Here’s What’s New!

Back in May, we talked a bit aboutJair Player, a nice looking music … more

Paid Android App Developers Will Soon Have to Provide Physical Address

Google has now changed its policies regarding paid app developers. … more

Windows Developers Rejoice! Dev Program’s $99 Yearly Fee is No More!

Microsoft rule in the mobile market, much like the giant dinosaurs … more