All ADB Commands for Android
Connect 25
Type on your computerWhat it does
Get started
brew install --cask android-platform-toolsInstalls ADB on a Mac.
winget install Google.PlatformToolsInstalls ADB on Windows.
adb versionShows your ADB version.
adb devicesLists connected phones.
adb devices -lLists them with model names.
adb shellOpens a shell on the phone.
exitLeaves the shell.
adb helpLists every ADB command.
Fix a connection
adb kill-serverStops ADB on your computer.
adb start-serverStarts it again.
adb get-stateShows if the phone is ready.
adb get-serialnoShows the phone's serial number.
adb wait-for-deviceWaits until a phone connects.
adb server-statusShows ADB's version and Wi-Fi settings.
Wireless debugging
Turn on Wireless debugging in Developer options first.
adb pair 192.168.1.20:37099Pairs using the code on the phone.
adb connect 192.168.1.20:41235Connects over Wi-Fi.
adb mdns servicesFinds phones on your Wi-Fi.
adb disconnectDrops every Wi-Fi connection.
adb shell ip -f inet addr show wlan0Shows the phone's Wi-Fi IP address.
adb tcpip 5555Turns on Wi-Fi ADB over USB (Android 10 and older).
adb connect 192.168.1.20Connects after adb tcpip.
adb usbSwitches back to USB.
More than one phone
adb -s 1a2b3c4d shellPicks a phone by serial number.
adb -d shellPicks the phone on USB.
adb -e shellPicks the Wi-Fi phone or emulator.
Apps 28
Type on your computerWhat it does
Find apps
adb shell pm list packagesLists every app.
adb shell pm list packages -3Lists apps you installed.
adb shell pm list packages -sLists system apps.
adb shell pm list packages -dLists disabled apps.
adb shell pm list packages youtubeFinds apps with a word in the name.
adb shell pm list packages -i -3Shows which store installed each app.
adb shell "dumpsys window | grep mCurrentFocus"Shows the app on screen right now.
adb shell "dumpsys package com.google.android.youtube | grep versionName"Shows an app's version.
adb shell pm path com.google.android.youtubeShows where an app's APK is.
Install and uninstall
adb install app.apkInstalls an APK.
adb install -r app.apkUpdates an app and keeps its data.
adb install -g app.apkInstalls and grants every permission.
adb install-multiple base.apk split_config.arm64_v8a.apkInstalls a split APK.
adb uninstall com.example.appUninstalls an app.
adb uninstall -k com.example.appUninstalls it but keeps its data.
adb pull /data/app/~~Xf2Q==/com.example.app-Lk9w==/base.apk app.apkSaves an app's APK (path from pm path).
Open and stop
adb shell monkey -p com.google.android.youtube 1Opens an app.
adb shell am force-stop com.google.android.youtubeForce stops an app.
adb shell am kill com.google.android.youtubeCloses it if it's in the background.
adb shell pm clear com.google.android.youtubeDeletes an app's data.
adb shell pm trim-caches 999GClears every app's cache.
adb shell cmd package compile -m speed -f com.google.android.youtubeCompiles an app to open faster.
Permissions
adb shell pm grant com.example.app android.permission.CAMERAGives an app a permission.
adb shell pm revoke com.example.app android.permission.CAMERATakes a permission away.
adb shell pm grant com.example.app android.permission.WRITE_SECURE_SETTINGSLets automation apps change settings.
adb shell appops set com.google.android.youtube RUN_IN_BACKGROUND ignoreStops an app running in the background.
adb shell appops set com.google.android.youtube RUN_IN_BACKGROUND allowLets it run in the background again.
adb shell appops get com.google.android.youtubeShows an app's special permissions.
Debloat 8
Type on your computerWhat it does
Remove or turn off
adb shell pm uninstall --user 0 com.example.bloatRemoves an app, even a system one.
adb shell pm uninstall -k --user 0 com.example.bloatRemoves it but keeps its data.
adb shell pm disable-user --user 0 com.example.bloatTurns an app off without removing it.
adb shell pm uninstall-system-updates com.example.bloatRemoves a system app's updates.
Bring apps back
A factory reset also brings every removed app back.
adb shell cmd package install-existing com.example.bloatBrings back a removed app.
adb shell pm enable com.example.bloatTurns a disabled app back on.
adb shell pm list packages -uLists apps, including removed ones.
adb shell pm list packages -dLists apps you turned off.
Files 13
Type on your computerWhat it does
Copy files
adb push photo.jpg /sdcard/Download/Copies a file to the phone.
adb push MyFolder /sdcard/Copies a folder to the phone.
adb pull /sdcard/Download/file.pdfCopies a file to your computer.
adb pull /sdcard/DCIM/CameraCopies all your camera photos.
adb pull -a /sdcard/DCIM/CameraCopies them with their original dates.
Manage files
adb shell ls /sdcard/DownloadLists files in a folder.
adb shell mkdir /sdcard/BackupMakes a folder.
adb shell mv /sdcard/Download/a.pdf /sdcard/Backup/Moves a file.
adb shell rm /sdcard/Download/file.pdfDeletes a file.
adb shell rm -r /sdcard/BackupDeletes a folder.
adb shell "find /sdcard -name '*.apk'"Finds files by name.
Storage
adb shell df -h /dataShows free storage.
adb shell du -sh /sdcard/DCIMShows a folder's size.
Screen and buttons 32
Type on your computerWhat it does
Screenshots and recording
adb shell screencap -p /sdcard/screen.pngTakes a screenshot.
adb pull /sdcard/screen.pngCopies it to your computer.
adb exec-out screencap -p > screen.pngSaves it straight to your computer (not in PowerShell).
adb shell screenrecord /sdcard/video.mp4Records the screen. Ctrl + C stops it.
adb shell screenrecord --time-limit 30 /sdcard/video.mp4Records for 30 seconds.
adb shell screenrecord --size 1280x720 /sdcard/video.mp4Records at a smaller size.
adb shell screenrecord --bit-rate 8000000 /sdcard/video.mp4Sets the video quality.
Tap, swipe and type
adb shell input tap 540 1200Taps the screen at a point.
adb shell input swipe 540 1800 540 600Swipes up.
adb shell input swipe 540 1200 540 1200 800Long-presses a point.
adb shell input text hello%sworldTypes text (%s is a space).
adb shell cmd statusbar expand-notificationsPulls down notifications.
adb shell cmd statusbar expand-settingsOpens Quick Settings.
adb shell cmd statusbar collapseCloses them.
Buttons
adb shell input keyevent KEYCODE_HOMEPresses Home.
adb shell input keyevent KEYCODE_BACKPresses Back.
adb shell input keyevent KEYCODE_APP_SWITCHOpens recent apps.
adb shell input keyevent KEYCODE_POWERPresses the power button.
adb shell input keyevent KEYCODE_WAKEUPWakes the screen.
adb shell input keyevent KEYCODE_VOLUME_UPTurns the volume up.
adb shell input keyevent KEYCODE_VOLUME_DOWNTurns the volume down.
adb shell input keyevent KEYCODE_MEDIA_PLAY_PAUSEPlays or pauses music.
adb shell input keyevent KEYCODE_ENTERPresses Enter.
adb shell input keyevent KEYCODE_DELDeletes a letter.
Display
adb shell wm sizeShows the screen resolution.
adb shell wm size 1080x1920Changes the resolution.
adb shell wm size resetPuts it back.
adb shell wm densityShows the screen density.
adb shell wm density 380Makes everything smaller or bigger.
adb shell wm density resetPuts it back.
adb shell wm user-rotation lock 1Locks the screen sideways.
adb shell wm user-rotation freeLets it rotate again.
Settings tweaks 28
Type on your computerWhat it does
Faster animations
Use 1 to undo, or 0 to turn animations off.
adb shell settings put global window_animation_scale 0.5Speeds up window animations.
adb shell settings put global transition_animation_scale 0.5Speeds up screen changes.
adb shell settings put global animator_duration_scale 0.5Speeds up app animations.
Block ads with Private DNS
adb shell settings put global private_dns_mode hostnameTurns on Private DNS.
adb shell settings put global private_dns_specifier dns.adguard-dns.comUses AdGuard DNS to block ads.
adb shell settings get global private_dns_specifierShows your DNS.
adb shell settings put global private_dns_mode offTurns Private DNS off.
Screen and power
adb shell cmd uimode night yesTurns dark mode on.
adb shell cmd uimode night noTurns dark mode off.
adb shell settings put system screen_brightness 200Sets brightness (0 to 255).
adb shell settings put system font_scale 1.15Makes text bigger.
adb shell settings put system screen_off_timeout 600000Keeps the screen on for 10 minutes.
adb shell svc power stayon trueKeeps the screen on while charging.
adb shell svc power stayon falseTurns that off.
Connections
adb shell cmd wifi set-wifi-enabled disabledTurns Wi-Fi off.
adb shell cmd wifi set-wifi-enabled enabledTurns Wi-Fi on.
adb shell cmd wifi statusShows Wi-Fi details.
adb shell svc data disableTurns mobile data off.
adb shell svc data enableTurns mobile data on.
adb shell svc bluetooth disableTurns Bluetooth off.
adb shell svc bluetooth enableTurns Bluetooth on.
adb shell cmd connectivity airplane-mode enableTurns airplane mode on.
adb shell cmd connectivity airplane-mode disableTurns airplane mode off.
Open settings screens
adb shell am start -a android.settings.SETTINGSOpens Settings.
adb shell am start -a android.settings.APPLICATION_DEVELOPMENT_SETTINGSOpens Developer options.
adb shell am start -a android.settings.WIFI_SETTINGSOpens Wi-Fi settings.
adb shell am start -a android.intent.action.VIEW -d https://techpp.appOpens a website.
adb shell settings list globalLists every global setting.
Phone info and logs 29
Type on your computerWhat it does
About the phone
adb shell getprop ro.product.modelShows the model.
adb shell getprop ro.product.brandShows the brand.
adb shell getprop ro.build.version.releaseShows the Android version.
adb shell getprop ro.build.version.security_patchShows the security patch date.
adb shell getprop ro.build.display.idShows the build number.
adb shell getprop ro.soc.modelShows the chip model.
adb shell getprop ro.product.cpu.abiShows the CPU type.
adb shell "grep MemTotal /proc/meminfo"Shows total RAM.
adb shell settings get secure android_idShows the Android ID.
adb shell uptimeShows time since the last restart.
adb shell getpropLists every property.
Battery
adb shell dumpsys batteryShows battery level, health and heat.
adb shell "dumpsys battery | grep level"Shows just the battery level.
adb shell cmd battery unplugActs as if the charger is unplugged.
adb shell cmd battery set level 15Fakes a battery level for testing.
adb shell cmd battery resetGoes back to the real battery.
Speed and memory
adb shell top -n 1Shows what's using the CPU.
adb shell dumpsys cpuinfoShows CPU use by app.
adb shell dumpsys meminfoShows memory use by app.
adb shell dumpsys meminfo com.google.android.youtubeShows one app's memory use.
adb shell dumpsys thermalserviceShows the phone's temperatures.
adb shell dumpsys gfxinfo com.google.android.youtubeShows an app's frame times.
adb shell ps -ALists every running process.
Logs and bug reports
adb logcatShows the live log.
adb logcat "*:E"Shows only errors.
adb logcat -b crashShows only crashes.
adb logcat -d > log.txtSaves the log to a file.
adb logcat -cClears the log.
adb bugreportSaves a full bug report as a zip.
Reboot and fastboot 24
Type on your computerWhat it does
Restart
adb rebootRestarts the phone.
adb reboot bootloaderRestarts into the bootloader (fastboot).
adb reboot recoveryRestarts into recovery.
adb reboot fastbootRestarts into fastbootd.
adb reboot sideloadRestarts ready to sideload an update.
adb sideload update.zipInstalls an update file.
adb shell svc power shutdownTurns the phone off.
adb rootRestarts ADB as root (test builds only).
Fastboot basics
fastboot devicesLists phones in fastboot.
fastboot rebootRestarts into Android.
fastboot reboot bootloaderRestarts the bootloader.
fastboot reboot recoveryRestarts into recovery.
fastboot reboot fastbootSwitches to fastbootd.
fastboot getvar allShows every bootloader detail.
fastboot getvar current-slotShows the active slot.
Unlock and flash
Turn on OEM unlocking in Developer options first.
fastboot flashing get_unlock_abilityChecks if unlocking is allowed.
fastboot flashing unlockUnlocks the bootloader. Wipes the phone.
fastboot flashing lockLocks it again. Resets the phone.
fastboot flash boot boot.imgFlashes a boot image.
fastboot flash init_boot init_boot.imgFlashes init_boot on newer phones.
fastboot boot boot.imgBoots an image once without flashing.
fastboot set_active bSwitches to slot b.
fastboot update image.zipFlashes a full factory image zip.
fastboot -wWipes all your data.