# ADB command list

Use Ctrl + F shortcut to quickly find the command you need ^\_^

### 1.Functional class

| Name                                                                          | Command                                                       | Remarks                                                                        |
| ----------------------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------ |
| Restart                                                                       | adb reboot                                                    | <p><br></p>                                                                    |
| Restart the phone to recovery flash mode                                      | adb reboot recovery                                           | <p><br></p>                                                                    |
| Restart the phone to the bootloader interface                                 | adb reboot bootloader                                         | <p><br></p>                                                                    |
| Shut down                                                                     | adb shell reboot -p                                           | <p><br></p>                                                                    |
| Restore Device DPI                                                            | adb shell wm density reset                                    | <p><br></p>                                                                    |
| Modify Device DPI                                                             | adb shell wm density 320                                      | 320 (custom dpi)                                                               |
| View Device DPI                                                               | adb shell wm density                                          | <p><br></p>                                                                    |
| Restore device resolution                                                     | adb shell wm size reset                                       | <p><br></p>                                                                    |
| Modify device resolution                                                      | adb shell wm size 1080x1920                                   | 1080X1920 (custom resolution)                                                  |
| View device resolution                                                        | adb shell wm size                                             | <p><br></p>                                                                    |
| View device serial number                                                     | adb get-serialno                                              | <p><br></p>                                                                    |
| View device details list                                                      | adb devices -l                                                | <p><br></p>                                                                    |
| View the third-party app package name                                         | adb shell pm list packages -3                                 | <p><br></p>                                                                    |
| View all package names of system applications                                 | adb shell pm list packages -s                                 | <p><br></p>                                                                    |
| View all app package names                                                    | adb shell pm list packages                                    | <p><br></p>                                                                    |
| View memory usage                                                             | adb shell dumpsys meminfo                                     | <p><br></p>                                                                    |
| Clear application data and cache, package needs to be specified               | adb shell pm clear cn.com.test.mobile                         | cn.com . test.mobile (Custom package name)                                     |
| Uninstall the application, you need to specify the package.                   | adb uninstall cn.com.test.mobile                              | cn.com . test.mobile (Custom package name)                                     |
| Uninstall the application, but keep the data, you need to specify the package | adb uninstall -k cn.com.test.mobile                           | cn.com . test.mobile (Custom package name)                                     |
| Force stop application                                                        | adb shell am force-stop cn.com.test.mobile                    | cn.com . test.mobile (Custom package name)                                     |
| Screenshot                                                                    | adb shell screencap -p /sdcard/01.png                         | 01.Png (Custom screenshot name)                                                |
| Install apk                                                                   | adb install d:/temp/1.apk                                     | D:/temp/1.apk (apk absolute path)                                              |
| Set battery percentage                                                        | adb shell dumpsys battery set level 100                       | 100 (custom battery percentage)                                                |
| Launch the app                                                                | adb shell am start -ncn.com.test.mobile/.ui.SplashActivity    | ncn.com .Ui. SplashActivity (package name)                                     |
| Check the Android system version                                              | adb shell getprop ro.build.version.release                    | <p><br></p>                                                                    |
| Check the top 10 apps that occupy memory                                      | adb shell top -s 10                                           | <p><br></p>                                                                    |
| View equipment brand                                                          | adb shell getprop ro.product.brand                            | <p><br></p>                                                                    |
| Turn on WiFi                                                                  | adb shell svc wifi enable                                     | <p><br></p>                                                                    |
| Turn off WiFi                                                                 | adb shell svc wifi disable                                    | <p><br></p>                                                                    |
| Enable pointer display                                                        | adb shell settings put system pointer\_location 1             | <p><br></p>                                                                    |
| Turn off pointer display                                                      | adb shell settings put system pointer\_location 0             | <p><br></p>                                                                    |
| Simulated click                                                               | Adb shell input tap x coordinate y coordinate                 | <p><br></p>                                                                    |
| Turn off updates                                                              | adb shell pm disable-user com.wssyncmldm                      | <p><br></p>                                                                    |
| Execute when the screen is black                                              | adb shell settings put system screen\_off\_timeout 2147483647 | Execute once every time the software is restarted (not in black screen state). |

### 2.Button type

| Name                                        | Command                                | Remarks                                                                                                                                                                          |
| ------------------------------------------- | -------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Power button                                | adb shell input keyevent 26            | <p><br></p>                                                                                                                                                                      |
| Menu key                                    | adb shell input keyevent 82            | <p><br></p>                                                                                                                                                                      |
| HOME key                                    | adb shell input keyevent 3             | <p><br></p>                                                                                                                                                                      |
| Return key                                  | adb shell input keyevent 4             | <p><br></p>                                                                                                                                                                      |
| Increase volume                             | adb shell input keyevent 24            | <p><br></p>                                                                                                                                                                      |
| Lower the volume                            | adb shell input keyevent 25            | <p><br></p>                                                                                                                                                                      |
| Mute                                        | adb shell input keyevent 164           | <p><br></p>                                                                                                                                                                      |
| Play/Pause                                  | adb shell input keyevent 85            | <p><br></p>                                                                                                                                                                      |
| Stop playing                                | adb shell input keyevent 86            | <p><br></p>                                                                                                                                                                      |
| Play the next song                          | adb shell input keyevent 87            | <p><br></p>                                                                                                                                                                      |
| Play the previous song                      | adb shell input keyevent 88            | <p><br></p>                                                                                                                                                                      |
| Resume playback                             | adb shell input keyevent 126           | <p><br></p>                                                                                                                                                                      |
| Pause playback                              | adb shell input keyevent 127           | <p><br></p>                                                                                                                                                                      |
| Light up the screen                         | adb shell input keyevent 224           | <p><br></p>                                                                                                                                                                      |
| Turn off the screen                         | adb shell input keyevent 223           | <p><br></p>                                                                                                                                                                      |
| Slide to unlock, swipe up gesture to unlock | adb shell input swipe 300 1000 300 500 | Parameters 300, 1000, 300, and 500 respectively represent the starting point x coordinate, starting point y coordinate, ending point x coordinate, and ending point y coordinate |
| Enter text when the focus is on a text box  | adb shell input text hello             | <p><br></p>                                                                                                                                                                      |

## Xiaomi MIUI ADB optimization command

| name                                        | Order                                                                   |
| ------------------------------------------- | ----------------------------------------------------------------------- |
| Disable smart services                      | adb shell pm disable-user com.miui.systemAdSolution                     |
| Disable Xiaomi e-commerce                   | adb shell pm disable-user com.xiaomi.ab                                 |
| Disable user feedback                       | adb shell pm disable-user com.miui.bugreport                            |
| Disable system toxicity                     | adb shell pm disable-user com.miui.analytics                            |
| Remove splash screen ads                    | adb shell rm -f -r /sdcard/Android/data/com.miui.systemAdSolution/files |
| Preventing splash screen ads from recurring | adb shell touch /sdcard/Android/data/com.miui.systemAdSolution/files    |
