Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,729,557 Members 46,558 Now Online
XDA Developers Android and Mobile Development Forum

Where is the Hosts File in Android?

Tip us?
 
saluk
Old
#1  
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

207.200.100.5 shoutcast.com
207.200.100.5 www.shoutcast.com



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...
 
rub1k
Old
#2  
Senior Member
Thanks Meter 24
Posts: 100
Join Date: Nov 2008
/etc/hosts
The Following User Says Thank You to rub1k For This Useful Post: [ Click to Expand ]
 
saluk
Old
#3  
Junior Member - OP
Thanks Meter 0
Posts: 5
Join Date: May 2009
Quote:
Originally Posted by rub1k View Post
/etc/hosts

Thx. I reached the file by a file manager app. but i cant open it with notepad apps. Do I need the root privilage?
 
persiansown
Old
#4  
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
Old
#5  
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
SHIFTAO5P V1.2X
 
saluk
Old
#6  
Junior Member - OP
Thanks Meter 0
Posts: 5
Join Date: May 2009
thx a lot for the answers. ill try it.
 
mindrot
Old
#7  
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.

thanks.
 
gophergun
Old
(Last edited by gophergun; 18th April 2010 at 10:22 AM.)
#8  
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
Old
#9  
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
Code:
 su
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
Old
#10  
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

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

Advanced Search
Display Modes


XDA PORTAL POSTS

Remove Unnecessary WhatsApp Elements with Xposed

In modern life, you can’t underestimate the power ofthe dark sidemessaging … more

MaR-V-iN to Talk Google and Android APIs at XDA:DevCon 2014

Our international xda:devcon 14in Manchester, UK on the weekend of September … more