Android(Linux)下查看系统启动时间和运行时间:
2.查看/proc/uptime文件计算系统启动时间
第一数字即是系统已运行的时间321363.36 秒,运用系统工具date即可算出系统启动时间
输出: 2016-09-20 19:41:54
3.查看/proc/uptime文件计算系统运行时间
adb shell cat /proc/uptime| awk -F. '{run_days=$1 / 86400;run_hour=($1 % 86400)/3600;run_minute=($1 % 3600)/60;run_second=$1 % 60;printf("系统已运行:%d天%d时%d分%d 秒",run_days,run_hour,run_minute,run_second)}'
输出: 系统已运行:3天17时17分0 秒
1.uptime命令
ubuntu@ubuntu:~$ uptime
2.查看/proc/uptime文件计算系统启动时间
adb shell cat /proc/uptime
第一数字即是系统已运行的时间321363.36 秒,运用系统工具date即可算出系统启动时间
输出: 2016-09-20 19:41:54
3.查看/proc/uptime文件计算系统运行时间
adb shell cat /proc/uptime| awk -F. '{run_days=$1 / 86400;run_hour=($1 % 86400)/3600;run_minute=($1 % 3600)/60;run_second=$1 % 60;printf("系统已运行:%d天%d时%d分%d 秒",run_days,run_hour,run_minute,run_second)}'
输出: 系统已运行:3天17时17分0 秒