1
Your device / Popular adb commands
« on: November 01, 2024, 02:02:36 PM »Popular adb commands
Code: [Select]
adb shell
//launches a shell on the deviceCode: [Select]
adb push <local> <remote>
//pushes the file <local> to <remote>Code: [Select]
adb pull <remote> [<local>]
//pulls the file <remote> to <local>. If <local> isn’t specified, it will pull to the current folder.Code: [Select]
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 colourCode: [Select]
adb install <file>
//installs the given .apk file to your device.Basic Operations
Install an app.
Code: [Select]
adb install -r xxx.apk
//Reinstall the existing application and retain its data and cached files.Code: [Select]
adb install -s xxx.apk
//Install the APK to the SD card.Code: [Select]
adb install -f xxx.apk
//Install the APK to the internal system memory.Obtain the installation position.
Code: [Select]
adb shell pm get-install-location
Uninstall an app.
Code: [Select]
adb uninstall <package>
Code: [Select]
adb uninstall -k <package>
//Uninstall the app but retain its data and cached files.Start ADB.
Code: [Select]
adb start-server
Stop ADB.
Code: [Select]
adb kill-server
Go to the shell environment.
Code: [Select]
adb shell
Exit from the shell environment.
Code: [Select]
exit
Checking Device Information
Check the connected device and its serial number.
Code: [Select]
adb devices
Check the CPU architecture and number of cores of a cloud phone.
Code: [Select]
adb shell cat /proc/cpuinfo
Check detailed system memory information.
Code: [Select]
adb shell cat /proc/meminfo
Obtain the disk space of a cloud phone.
Code: [Select]
adb shell df
Obtain the OS version of a cloud phone.
Code: [Select]
adb shell getprop ro.build.version.release
Obtain the MAC address of a cloud phone.
Code: [Select]
adb shell cat /sys/class/net/wlan0/address
Software Package Manager
Clear all data associated with an application.
Code: [Select]
adb shell pm clear <package>
View the APK path of a specified application.
Code: [Select]
adb shell pm path <package>
Check the package names of all installed applications.
Code: [Select]
adb shell pm list packages
Check the application package whose name contains the "android" field.
Code: [Select]
adb shell pm list packages android
Check the package name of a third-party application.
Code: [Select]
adb shell pm list packages -3
Checking Processes
Check the memory usage of each process.
Code: [Select]
adb shell procrank
Check the process information about an application.
Code: [Select]
adb shell "ps | grep <package>"
Kill a process.
Code: [Select]
adb shell kill [pid]
File Operations
Send a file from a local device to a cloud phone.
Code: [Select]
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:
Code: [Select]
adb shell
cd /sdcard/Download
ls
Copy a file from a cloud phone to a local device.
Code: [Select]
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.
Code: [Select]
adb shell mv path/file newpath/file
Create a folder.
Code: [Select]
adb shell mkdir path
Create a file.
Code: [Select]
adb shell touch filename
Rename a file or folder.
Code: [Select]
adb shell rename path/filename newpath/newfilename
Check the file content.
Code: [Select]
adb shell cat file
--