1.cat命令
用于查看文件內容,結合|grep可以對單行文本進行過濾(即顯示出含有過濾字符串的當前行)
例子:cat test.txt |grep handsome
注意:linux過濾用grep,windows則用findstr
2.echo/touch/open
用于創(chuàng)建文件和寫文件
用法:
1)touch test.txt 創(chuàng)建test.txt文件
2) open text.txt打開text.txt文件
3)cat content > text.txt 創(chuàng)建text.txt文件并寫入content
4)cat list >> text.txt 向text.txt追加內容list
3.adb shell
1)adb shell dumpsys activity top? 查看當前應用activity信息
2)adb shell dumpsys package com.tencent.mm 查看指定包名應用的信息
3)adb shell dumpsys meminfo [pname/pid] 查看指定進程名或進程ID對應的內存信息
4)adb shell dumpsys dbinfo com.tencent.mm 查看指定包名的數(shù)據庫存貯信息
5)adb shell screencap -p /sdcard/t.png 截屏保存到設備
6)adb shell screenrecord --time-limit 5 /sdcard/demo.mp4 錄屏保存到設備
7)adb shell input text 123456 輸入文本到輸入框(密碼,長文本用起來方便)
8)? adb install demo.apk 安裝demo.apk,如果已經安裝則用adb install -r demo.apk
9) adb uninstall demo.apk 卸載demo.apk
10) adb pull /sdcard/text.txt ~/? 把設備上的文件放到本地,可能會有權限問題需用chmod修改權限
11)adb push ~/text.txt /sdcard/ 把本地的文件放到設備上面,可能會有權限問題需用chmod修改權限
12)adb forward 【遠端協(xié)議:端口號】【設備協(xié)議:端口號】
13)adb jdwp 查看設備中可以被調試的進程號
14) adb logcat -s tag 查看logcat日志
4.shell
1) am start -D -n com.android.browser/com.android.browser.BrowserActivity 用Debug方式啟動應用
2)am startservice -n com.android.test/com.android.test.CusService 啟動服務
3)am broadcast -a com.android.intent.ACTION.LOGIN 發(fā)送廣播
4)netcfg 查看設備ip
5)aapt dump xmltree /data/demo.apk activity_main.xml 查看xml資源內容
6)dexdump /data/test.dex 查看dex文件的詳細信息
7)cat /proc/[pid]/maps 查看當前進程的內存映射信息,比如加載了那些so和dex等
8)cat /proc/[pid]/status 查看當前進程的狀態(tài)信息