2013.07.22——— android 修改hosts
2013.07.22——— android 修改hosts
参考:http://www.cnblogs.com/xiaowenji/archive/2011/03/12/1982309.html
http://weiweiabc109.blog.163.com/blog/static/28357220123211481870/
前提:手机已经root了
准备工具:
1、Better Terminal Emulator Pro
下载地址:http://apk.91.com/Soft/Android/betterterminalemulatorpro-2.19.html
汉化版:http://www.miui.com/thread-60997-1-1.html
一个android版的终端命令行
2、busybox
下载地址:http://www.busybox.net/downloads/binaries/
BusyBox 是标准 Linux 工具的一个单个可执行实现。BusyBox 包含了一些简单的工具,例如 cat 和 echo,还包含了一些更大、更复杂的工具,例如 grep、find、mount 以及 telnet。有些人将 BusyBox 称为 Linux 工具里的瑞士军刀.简单的说BusyBox就好像是个大工具箱,它集成压缩了 Linux 的许多工具和命令。(摘自百度百科)
对我们来说,最重要的是提供了手机没有的vi
安装busybox:
1、将busybox传入手机的SD卡
adb push d:/busybox /mnt/sdcard
mount -o remount rw /system
mkdir xbinchmod 755 busybox
chmod 755 busybox
cat /mnt/sdcard/busybox > /system/xbin/busyboxchmod 755 busybox
busybox --install .
alias ls='busybox ls'
adb shellsumount -o remount rw /systemadb pull /system/etc/hosts d:/hosts //获取手机上的hosts文件在电脑上修改hosts文件adb push d:/hosts /system/etc/hosts //覆盖手机上的host文件
打开Better Terminal Emulator Prosumount -o remount rw /systemvi /system/etc/hostsvi操作修改hosts:x
Alt+1 为退出输入模式用better Terminal可以获得命令行操作vi hosts命令模式:n 是跳转到第几行k j 是上一行或下一行h 左移一个字符l 右移一个字符dd 删除一行进入输入模式i当前位置 o 下一行a 光标的下一个位置 点一下屏幕 出现<这个符号 就是alt 然后输入1 就退出输入模式:x 保存退出