文章目录
本文首发地址 https://h89.cn/archives/281.html
最新更新地址 https://gitee.com/chenjim/chenjimblog
博主 Linux 使用较多,平时开发使用各种命令也比较多,之前写过一篇博文 安卓软件开发常用命令集合,其中 adb 相关命令最多,这里把 adb 相关抽离、补充完善。adb shell ls /system/bin/ 列出的命令均可以通过 adb shell 执行,本文主要介绍博主经常用到的命令使用及功能
文件管理
- 导出文件到电脑
adb pull /system/priv-app/ p-app - 推送文件到手机
adb push ./out.so /system/lib64 - rm/touch/mkdir/cp/mv/find/grep 使用同 Linux 命令
adb shell rm /system/lib64/out.so
截屏与录屏
-
截屏并导出文件到电脑
adb exec-out screencap -p > screen.png
adb shell input keyevent 120 -
录屏
adb shell screenrecord /sdcard/example.mp4
adb pull /sdcard/example.mp4
logcat 使用
-
logcat 并用tee重定向输出到文件log.txt
adb logcat |tee log.txt -
logcat过滤关键字abc的日志
adb logcat | grep abcgrep在windows依赖C:\Program Files\Git\usr\bin\grep.exe
adb shell "logcat | grep abc"使用android系统的grep命令
先adb shell,然后logcat | grep -iE "abc|def"过滤包含 abc 或者包含 def 的内容,-i 表示忽略大小写
先adb shell,然后logcat | grep abc | grep def"过滤包含 abc 且包含 def 的内容 -
只过滤
tag为abc的日志
adb logcat -s abc -
查看
events日志
adb logcat -b events抓events,默认是main,system,crash,可选项main system radio events crash
adb logcat -b all可抓取所有(main+system+kernel+events等)日志
更多grep用法,可参考 linux-grep -
logcat 只抓去

最低0.47元/天 解锁文章
4620

被折叠的 条评论
为什么被折叠?



