读取 android的内存、cpu、流量等 信息

本文详细介绍了如何在Linux系统中进行内存管理、CPU信息获取、网络流量监控、hosts文件编辑及DNS配置等核心操作,提供了从入门到进阶的学习路径。

内存总量:/proc/meminfo
cpu信息:/proc/cpuinfo
cpu使用率:/proc/stat
流量信息:/proc/self/net/dev /proc/net/dev
etc/network/interfaces 这个文件是保存ip,netmask,gateway信息的(包括静态和动态),实时生效的
/etc/resolv.conf 这个文件是保存DNS服务器信息的,实时生效
/etc/hosts 、/etc/hostname 在基于debian的linux系统中,修改主机名称,需要修改这两个文件,必须重启才能生效

  

android–修改hosts

 

在Android下,/etc是link到/system/etc的,我们需要修改/system/etc/hosts来实现。但是这个文件是只读,不能通过shell直接修改。可以通过连接到PC上使用adb来修改。步骤如下:

1、获得root权限:adb root

2、设置/system为可读写:adb remount

3、将hosts文件复制到PC:adb pull /system/etc/hosts  

4、修改PC机上文件

5、将PC机上文件复制到手机:adb push /system/etc/hosts

如果要查看是否修改成功,可以在PC上执行adb shell,运行cat /system/etc/hosts;或者在手机上运行cat /system/etc/hosts。

转载于:

转载于:https://www.cnblogs.com/ouling/archive/2011/06/20/2085354.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值