adb
Android Debug Bridge
# check version
adb version
# view connected devices
adb devices
# exec commands on android
adb shell ls /sdcard
# pull file to local
adb pull /sdcard/Download/file.txt .
# push file to android
adb push install.apk /sdcard/Download/
# 推送到手机下载文件夹,方便查找
adb push recovery.img /sdcard/Download/
# 1. push & use magisk patch
adb push boot.img /sdcard/Download/
# 2. pull patched img back
adb pull /sdcard/Download/magisk_patched-xxx.img D:\Magisk_Extract\
# 3. press Power + Volume Down btns, enter fastboot mode, then exec
fastboot flash boot magisk_patched-xxx.img
fastboot reboot
# enter shell
adb shell
# use root
su
magisk --activate
# 先把系统文件复制到普通目录(如/sdcard),再pull到电脑
cp /system/etc/security/cacerts/mitmproxy.crt /sdcard/
# 停止旧版ADB服务
adb kill-server
# 删除旧版ADB残留进程(可选,确保彻底清理)
taskkill /f /im adb.exe
# 重启ADB服务
adb start-server
# install app
adb install magisk.apk
# -r表示覆盖现有版本, 保留数据
adb install -r Magisk-v30.6.apk
# or you can use
# 1. 将APK推送到手机下载文件夹
adb push Magisk-v30.6.apk /sdcard/Download/
# 2. 在手机端安装推送的APK
adb shell pm install /sdcard/Download/Magisk-v30.6.apk
# 查看手机已安装应用,确认Magisk存在
adb shell pm list packages | findstr magisk
# 尝试进入fastboot
adb reboot bootloader
# 手机连接电脑,执行命令进入临时recovery
adb reboot recovery
# USB update mode:用于 ADB sideload 刷包,适合本地包有问题时用电脑推送
# 等待进入recovery模式后,执行刷入命令(部分机型支持)
adb sideload D:\Magisk_Recovery\magisk_patched-30600_xxxx_recovery.img
# unlock with oem
fastboot oem unlock <your_unlok_code>
# Get serial number
adb get-serialno
# Get Android version
adb shell getprop ro.build.version.release
# Get SDK version
adb shell getprop ro.build.version.sdk
# Get Model info
adb shell getprop ro.product.model
# Get CPU info
adb shell getprop ro.product.cpu.abi
# Get all properties
adb shell getprop
# Get RAM info
adb shell cat /proc/meminfo
# Get Storage info
adb shell df -h /data
# /dev/block/dm-39 226G 19G 207G 9% /apex/com.android.art/bin/dex2oat32
# Get Battery info
adb shell dumpsys battery
# Get installed app list
adb shell pm list packages
# View log
adb logcat | grep reqable
# 关闭 SELinux
adb shell su -c setenforce 0
Magisk
certs
# 1. 电脑生成证书hash
openssl x509 -inform PEM -subject_hash_old -in ~/.mitmproxy/mitmproxy-ca-cert.pem | head -1
# 2. 改名证书为[hash].0(如c8750f0d.0)
# 3. ADB推送到系统证书目录(需Root)
adb push c8750f0d.0 /system/etc/security/cacerts/
adb shell chmod 644 /system/etc/security/cacerts/c8750f0d.0
Page Source