The ADB is powerful, and remembering some of the ADB commands can help improve productivity.
-
Get Serial Number:
ADB Get-serialno
-
To view the devices that connect to your computer:
ADB devices
-
Restart the machine:
ADB reboot
-
Restart to bootloader, which is the brush mode:
ADB reboot bootloader
-
Restart to recovery, which is the recovery mode:
ADB reboot Recovery
-
View log:
ADB logcat
-
To terminate the ADB service process:
ADB kill-server
-
To restart the ADB service process:
ADB start-server
-
Get Machine MAC Address:
ADB Shell cat/sys/class/net/wlan0/address
-
Get the CPU serial number:
ADB Shell Cat/proc/cpuinfo
-
Install APK:
ADB install <<span style= "padding:0px; margin:0px; line-height:21px; " >apkfile>//For example: adb install baidu.apk
-
Keep the data and cache files and reinstall the APK:
ADB install-r <<span style= "padding:0px; margin:0px; line-height:21px; " >apkfile>//For example: ADB install-r baidu.apk
-
Install apk to SD card:
ADB install-s <<span style= "padding:0px; margin:0px; line-height:21px; " >apkfile>//For example: ADB install-s baidu.apk
-
Uninstall APK:
ADB uninstall <<span style= "padding:0px; margin:0px; line-height:21px; " >package>//For example: ADB uninstall Com.baidu.search
-
Uninstall the app but keep the data and cache files:
ADB uninstall-k <<span style= "padding:0px; margin:0px; line-height:21px; " >package>//For example: ADB uninstall-k com.baidu.search
-
To launch an app:
ADB shell am start-n <<span style= "padding:0px; margin:0px; line-height:21px; " >package_name>/.<<span style= "padding:0px; margin:0px; line-height:21px; " >activity_class_name>
-
To view the CPU and memory consumption of the device:
ADB Shell Top
-
To see the top 6 apps that occupy memory:
ADB Shell Top-m 6
-
Refreshes the memory information once and then returns:
ADB Shell Top-n 1
-
Query the memory usage of each process:
ADB Shell Procrank
-
Kill a process:
ADB shell kill [PID]
-
To view a list of processes:
ADB Shell PS
-
To view the status of a specified process:
adb shell Ps-x [PID]
-
To view background services information:
ADB Shell Service List
-
To view current memory consumption:
ADB Shell Cat/proc/meminfo
-
To view the IO memory partition:
ADB Shell Cat/proc/iomem
-
To re-mount the system partition as a read-write partition:
ADB remount
-
Copy files from local to device:
ADB push <<span style= "padding:0px; margin:0px; line-height:21px; " >local> <<span style= "padding:0px; margin:0px; line-height:21px; " >remote>
-
Copy files from device to Local:
ADB pull <<span style= "padding:0px; margin:0px; line-height:21px; " >remote> <<span style= "padding:0px; margin:0px; line-height:21px; " >local>
-
Lists the files and folders in the directory, equivalent to the dir command in DOS:
ADB Shell ls
-
Enter the folder, equivalent to the CD command in DOS:
adb shell CD <<span style= "padding:0px; margin:0px; line-height:21px; " >folder>
-
To rename a file:
adb shell rename Path/oldfilename path/newfilename
-
Delete system/avi.apk:
ADB Shell rm/system/avi.apk
-
Delete the folder and all the files below it:
adb shell rm-r <<span style= "padding:0px; margin:0px; line-height:21px; " >folder>
-
To move a file:
ADB shell MV Path/file newpath/file
-
To set file permissions:
ADB shell chmod 777/system/fonts/droidsansfallback.ttf
-
New folder:
ADB shell mkdir path/foldelname
-
To view the contents of a file:
ADB shell cat <<span style= "padding:0px; margin:0px; line-height:21px; " >file>
-
To view WiFi password:
ADB Shell cat/data/misc/wifi/*.conf
-
Clear the log cache:
ADB logcat-c
-
To view the bug report:
ADB bugreport
-
Get Device Name:
ADB Shell Cat/system/build.prop
-
View ADB help:
ADB Help
-
Run Monkey:
adb shell Monkey-v-P Your.package.name 500