Popular adb commands
adb shell
//launches a shell on the device
adb push <local> <remote>
//pushes the file <local> to <remote>
adb pull <remote> [<local>]
//pulls the file <remote> to <local>. If <local> isnβt specified, it will pull to the current folder.
adb logcat
//allows you to view the device log in real-time. You can use adb logcat -b radio to view radio logs, and adb logcat -C to view logs in colour
adb install <file>
//installs the given .apk file to your device.
Basic Operations
Install an app.
adb install -r xxx.apk
//Reinstall the existing application and retain its data and cached files.
adb install -s xxx.apk
//Install the APK to the SD card.
adb install -f xxx.apk
//Install the APK to the internal system memory.
Obtain the installation position.
adb shell pm get-install-location
Uninstall an app.
adb uninstall <package>
adb uninstall -k <package>
//Uninstall the app but retain its data and cached files.
Start ADB.
adb start-server
Stop ADB.
adb kill-server
Go to the shell environment.
adb shell
Exit from the shell environment.
exit
Checking Device Information
Check the connected device and its serial number.
adb devices
Check the CPU architecture and number of cores of a cloud phone.
adb shell cat /proc/cpuinfo
Check detailed system memory information.
adb shell cat /proc/meminfo
Obtain the disk space of a cloud phone.
adb shell df
Obtain the OS version of a cloud phone.
adb shell getprop ro.build.version.release
Obtain the MAC address of a cloud phone.
adb shell cat /sys/class/net/wlan0/address
Software Package Manager
Clear all data associated with an application.
adb shell pm clear <package>
View the APK path of a specified application.
adb shell pm path <package>
Check the package names of all installed applications.
adb shell pm list packages
Check the application package whose name contains the "android" field.
adb shell pm list packages android
Check the package name of a third-party application.
adb shell pm list packages -3
Checking Processes
Check the memory usage of each process.
adb shell procrank
Check the process information about an application.
adb shell "ps | grep <package>"
Kill a process.
adb shell kill [pid]
File Operations
Send a file from a local device to a cloud phone.
adb push file mobile_directory
Example:
Send file C:/Downloads/test.png /data/media/0/Pictures on the local device to the cloud phone directory /data/media/0/Pictures by running the following command: adb push C:/Downloads/test.png /data/media/0/Pictures. To check whether the file is sent successfully, run the following commands:
adb shell
cd /sdcard/Download
ls
Copy a file from a cloud phone to a local device.
adb pull file local_computer_directory
Example:
Copy file /sdcard/Download/test.png on a cloud phone to the C:/Downloads directory on a local device by running the following command: adb pull /sdcard/Download/test.png C:/Downloads.
Move a file or folder.
adb shell mv path/file newpath/file
Create a folder.
adb shell mkdir path
Create a file.
adb shell touch filename
Rename a file or folder.
adb shell rename path/filename newpath/newfilename
Check the file content.
adb shell cat file
--