This article was reproduced from: https://zmywly8866.github.io/2015/01/24/all-adb-command.html
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 <apkfile> //比如:adb install baidu.apk
-
Keep the data and cache files and reinstall the APK:
adb install -r <apkfile> //比如:adb install -r baidu.apk
-
Install apk to SD card:
adb install -s <apkfile> // 比如:adb install -s baidu.apk
-
Uninstall APK:
adb uninstall <package> //比如:adb uninstall com.baidu.search
-
Uninstall the app but keep the data and cache files:
adb uninstall -k <package> //比如:adb uninstall -k com.baidu.search
-
To launch an app:
adb shell am start -n <package_name>/.<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 <local> <remote>
-
Copy files from device to Local:
adb pull <remote> <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 <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 <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 <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