home page > Programmer development tools > Complete set of adb commands

Complete set of adb commands

ID command describe
one adb devices View connected devices
two adb tcpip 5555 Set the target device to listen for TCP/IP connections on port 5555
three adb connect device_ip_address:5555 Connect to the device through the IP address, device_ip_address: device IP address
four adb kill-server Stop adb service
five adb start-server Start adb service
six adb -s emulator-5555 install helloWorld.apk -S specifies the device serial number. When multiple devices exist, the target device can be specified through - s. If more than one device is available, but only one is an emulator, use the - e option to send the command to the emulator. Similarly, if there are multiple devices but only one hardware device is connected, use the - d option to send the command to the hardware device.
seven adb install path_to_apk Install APK, path_to_apk: the address of the apk file.
eight adb forward tcp:6100 tcp:7100 Forwards requests on a specific host port to other ports on the device.
nine adb pull remote local Copy a file or directory (and its subdirectories) from the device to the local, remote: the file path on the device, local: the local path.
ten adb push local remote Copy a file or directory (and its subdirectories) to the device, remote: the file path on the device, local: the local path.
eleven adb shell am start -a android.intent.action. VIEW Issue the Activity Manager command through adb without entering the remote shell.
twelve adb shell ls /system/bin View a list of available tools.
thirteen adb shell screencap /sdcard/screen.png Screenshot of the device.
fourteen adb shell screenrecord /sdcard/demo.mp4 Device recording video
fifteen adb shell cmd testharness enable Reset test equipment
sixteen adb uninstall path_to_apk Set the target device to listen for TCP/IP connections on port 5555
seventeen adb help View adb command help information
eighteen adb shell dumpsys dbinfo package_name View the database storage information (including stored SQL statements) applied by the specified package name
nineteen adb shell dumpsys meminfo package_name/pid View the memory information of the specified process or process id
twenty adb shell dumpsys package_name View the details of the specified package name application
twenty-one adb shell pm list packages List all apk package names installed on the phone
twenty-two adb shell pm list packages -s List system applications installed on mobile phones
twenty-three adb shell pm list packages -3 List third-party apps installed on your phone
twenty-four adb shell pm list packages | grep camera Use grep to filter applications
twenty-five adb shell am start -n module_name+activity Launch application page through adb
twenty-six adb reboot reboot device
twenty-seven adb disconnect Disconnect Wireless
twenty-eight adb shell pm clear Clear application data and cache
twenty-nine adb shell dumpsys activity activities | grep mFocusedActivity View the currently running application activity
thirty adb shell am force-stop xxx Forced stop of application
thirty-one adb shell input keyevent 3 Simulation key: 3 ->HOME key | 4 ->Back key | 5 ->Open the dial-up application | 6 ->Hang up the phone | 24 ->Increase the volume | 25 ->Decrease the volume | 26 ->Power key | 27 ->Take a picture (required in the camera application) |64 ->Open browser | 82 ->Menu key | 85 ->Play/Pause | 86 ->Stop playing | 87 ->Play the next song | 88 ->Play the previous song | 122 ->Move the cursor to the beginning of the line or the top of the list | 123 ->Move the cursor to the end of the line or the bottom of the list | 126 ->Resume playing | 127 ->Pause playing | 164 ->Mute | 176 ->Open system settings | 187 ->Switch applications | 207 ->Open contacts | 208 ->Open day Calendar | 209 ->Turn on music | 210 ->Turn on calculator | 220 ->Decrease screen brightness | 221 ->Increase screen brightness | 223 ->System hibernation | 224 ->Turn on screen | 231 ->Turn on voice assistant
thirty-two adb shell input swipe 300 1000 300 500 Screen Slide
thirty-three adb logcat view log
thirty-four adb shell getprop ro.product.model View device model
thirty-five adb shell dumpsys battery View device battery information
thirty-six adb shell wm size View device screen resolution
thirty-seven adb shell dumpsys window displays View device screen parameters
thirty-eight adb shell getprop ro.build.version.release View the device system version
thirty-nine adb shell cat /sys/class/net/wlan0/address View device MAC address
forty adb shell cat /proc/cpuinfo View device CPU information
forty-one adb shell ps View Device Process
forty-two adb shell top View the usage of equipment resources