Appearance
ADB commands: a guide to the Android Debug Bridge
In short: ADB commands are what you type to work with an Android phone from a computer through the Android Debug Bridge, Google's command-line tool, over USB or Wi-Fi. They install apps, read logs, copy files, take screenshots and run shell commands on the phone. adb comes in Android SDK Platform-Tools for Windows, macOS and Linux.
This guide covers what ADB is, how to set it up, and the ADB commands people use most, each with its own page of flags, examples and fixes for the errors it gives. If you only want the list, jump to the commands you will use.
Free for up to 3 phones, with no account. Pro adds workflows, schedules and AI for up to 25 phones from $16 a month + VAT (including 300 cloud phone minutes every month).
How ADB works
ADB has three parts. The client is the adb command you type on your computer. The server runs in the background on your computer, listens on TCP port 5037 and keeps track of connected phones; the first adb command starts it. The daemon, adbd, runs on the phone and carries out the commands. That is why adb kill-server fixes so many connection problems: the next command starts a fresh server (adb start-server starts it on purpose).
Every adb command has the same shape: adb, then options that choose a phone, then the command and its arguments, for example adb -s R58M12345 install app.apk.
adb and adb shell
Commands such as adb install, adb pull and adb logcat run on your computer and talk to the phone. adb shell is different: it opens a command line on the phone itself, where Android's own tools run, such as pm (the package manager), am (the activity manager), input, settings and dumpsys. adb shell pm list packages is one adb command that runs one shell command on the phone. The adb shell commands page lists the useful ones.
Set up ADB
- On the phone, open Settings, then About phone, and tap Build number seven times to turn on Developer options.
- In Developer options, turn on USB debugging.
- On the computer, download Android SDK Platform-Tools from Google's Android developer site and unzip it, or install it with a package manager.
- Connect the phone with a USB cable, unlock it and tap Allow when it asks whether to allow USB debugging.
- In a terminal, run adb devices. The phone is listed with the word device when it is ready.
| Computer | Getting Platform-Tools |
|---|---|
| Windows | Download the ZIP for Windows from Google, unzip it (for example to C:\platform-tools) and add that folder to your PATH. Some phones also need their maker's USB driver. |
| macOS | brew install --cask android-platform-tools, or the ZIP from Google. |
| Linux | sudo apt install adb on Debian and Ubuntu, or the ZIP from Google. If adb says "no permissions", your user needs a udev rule for the phone. |
Prefer no cable? On Android 11 and newer, ADB over Wi-Fi pairs the phone with a code instead.
The commands you will use
The last column says what a command does to the phone: reads changes nothing, changes installs, copies or alters something you can undo, and erases deletes data for good.
| Task | Command | Effect |
|---|---|---|
| List the phones adb can see | adb devices -l | reads |
| Install an app from an APK | adb install -r app.apk | changes |
| List installed apps (package names) | adb shell pm list packages -3 | reads |
| Stop an app | adb shell am force-stop com.example.app | changes |
| Clear an app's data | adb shell pm clear com.example.app | erases |
| Remove an app | adb uninstall com.example.app | erases |
| Open a shell on the phone | adb shell | depends on what you type |
| Follow the log, or save it and stop | adb logcat, adb logcat -d > log.txt | reads |
| Copy a file to the phone | adb push report.pdf /sdcard/Download/ | changes |
| Copy files from the phone | adb pull /sdcard/DCIM/Camera | reads |
| Save a screenshot on your computer (bash) | adb exec-out screencap -p > screen.png | reads |
| Record the screen (up to 3 minutes) | adb shell screenrecord /sdcard/demo.mp4 | changes |
| Connect over Wi-Fi | adb connect 192.0.2.20:41037 | reads |
| Restart the phone | adb reboot | changes |
| Restart the ADB server | adb kill-server | reads |
com.example.app stands for an app's package name, which pm list packages shows; R58M12345 and 192.0.2.20:41037 stand for a phone's serial number and its IP address and port.
Each has a page of its own:
| Guide | What it covers |
|---|---|
| adb install | Install an APK or split APKs, and fix the errors installs give. |
| adb uninstall | Remove an app, keep its data, or find its package name. |
| adb shell | Run commands on the phone: apps, settings, input and system details. |
| adb logcat | Read, filter and save the phone’s log, and find why an app crashed. |
| adb devices | List connected phones and fix unauthorized, offline and missing ones. |
| ADB over Wi-Fi | Wireless debugging with adb pair, adb connect and adb tcpip. |
| adb screenshot and screenrecord | Take screenshots and record the screen from your computer. |
| adb push and pull | Copy files and folders between your computer and the phone. |
Want a command written for you? The free ADB command builder builds it for one phone or every phone, in bash or PowerShell, with the right quoting.
Commands that work on Windows, macOS and Linux
The adb commands are the same everywhere; the terminal around them is not.
- Starting adb. If the platform-tools folder is not on your PATH, run adb from inside it:
./adbin a macOS or Linux terminal and.\adbin PowerShell (Command Prompt takes plainadbin that folder). - Filtering output.
grepexists on macOS and Linux, and also on the phone. On Windows, filter on the phone (adb shell "pm list packages | grep google") or useSelect-Stringin PowerShell andfindstrin Command Prompt:adb shell pm list packages | Select-String google. - Saving binary output.
adb exec-out screencap -p > screen.pngworks in bash and zsh. In Windows PowerShell 5.1 the>redirection treats the output as text and breaks the image, so save the screenshot on the phone and copy it:adb shell screencap -p /sdcard/screen.png, thenadb pull /sdcard/screen.png. - Quoting. Put a whole shell command in double quotes when it has a pipe,
;or&&, so it all runs on the phone.
The ADB command builder writes each command with the right quoting for bash or PowerShell.
Working with several phones
When more than one phone is connected, adb needs to know which one you mean:
adb -s R58M12345 install app.apksends the command to the phone with that serial number;adb deviceslists them.-dchooses the only phone connected by USB,-ethe only emulator, and-ta transport ID fromadb devices -l.- Setting the
ANDROID_SERIALenvironment variable picks a phone for every command;-soverrides it.
To run a command on every phone, loop over the phones that adb devices lists as ready:
bash
for s in $(adb devices | awk 'NR>1 && $2=="device" {print $1}'); do
adb -s "$s" shell getprop ro.product.model
donepowershell
adb devices | Select-Object -Skip 1 | ForEach-Object {
$serial, $state = $_ -split '\s+'
if ($state -eq 'device') { adb -s $serial shell getprop ro.product.model }
}A loop is fine for a handful of phones. With ten or a hundred, you also want to see every screen, know which phone failed and why, and take over one by hand. That is what BenchFleet is for: every connected phone on one screen, one click to take control, and on Pro, group actions that install, launch, reboot or take screenshots on many phones at once. See controlling many Android phones from one PC and, for one phone on your desk, how to control an Android phone from a PC. For a bench of test phones, Android app testing on real devices shows a whole test run, and features lists everything else the app does.
Logs and diagnostics
adb logcat shows the phone's log as it happens. Filter it by priority (adb logcat *:E for errors and worse), by app (--pid with the app's process ID) or by buffer (-b crash for crash reports). For a full picture to send to a developer, adb bugreport bugreport.zip collects the logs, system state and device details in one ZIP file. The adb logcat page covers filtering, saving the log and reading a crash.
Reboot, recovery and root
| Command | What it does |
|---|---|
adb reboot | Restarts Android |
adb reboot recovery | Restarts into the recovery menu, where a factory reset and system updates live |
adb reboot bootloader | Restarts into the bootloader, where fastboot takes over |
adb sideload update.zip | Installs an update package after you choose "Apply update from ADB" in recovery |
adb root / adb unroot | Restarts adbd with or without root rights, on emulators and development builds only |
None of these needs root except adb root itself, which a retail phone refuses with "adbd cannot run as root in production builds". Commands that touch other apps' private data in /data, or system files, need a rooted phone or an emulator; everything else in this guide works on any phone with USB debugging on. A factory reset from the recovery menu erases everything on the phone, so copy what you need first with adb pull.
Can ADB unlock a phone?
Three different things get called unlocking:
- The screen lock (PIN, pattern, password). ADB cannot get past it on a phone you cannot already open. A computer can use ADB only after USB debugging was turned on in Developer options and that computer was allowed on the unlocked phone, at the RSA key prompt Android shows. On a phone you have already allowed,
adb shell input keyevent KEYCODE_WAKEUPwakes the screen, but nothing in adb removes a lock you do not know. - Root access. Rooting gives the shell more rights. It usually starts with an unlocked bootloader, and no everyday adb command needs it.
- The bootloader.
adb reboot bootloaderand thenfastboot flashing unlocklet you flash other system images on phones whose maker allows it, once OEM unlocking is on in Developer options. Android's rules for bootloaders have the phone do a factory data reset when it is unlocked, so this is no way into a phone's contents either (Android's bootloader documentation).
When adb does not work
Work down the list until one matches:
- "adb is not recognized" or "command not found". The terminal cannot find adb: run it from the platform-tools folder, or add that folder to your PATH and open a new terminal.
- The phone is not listed at all. Try another cable and USB port (some cables only charge), check that USB debugging is on, install the maker's USB driver on Windows, and on Linux add a udev rule. Then run
adb kill-serverandadb devicesagain. - Listed as
unauthorized. Unlock the phone and tap Allow on the USB debugging prompt. No prompt? Revoke USB debugging authorizations in Developer options, then unplug and plug in again. - Listed as
offline. Reconnect the cable, runadb kill-server, and update Platform-Tools if they are old. - "more than one device/emulator". Choose a phone with
-sand its serial number. - "Permission denied" inside
adb shell. The shell user may not touch that place; use/sdcard, or a rooted test phone.
The adb devices page explains each state and fix in more detail, and ADB over Wi-Fi the errors of a wireless connection.
Quick ADB error lookup
| Error message | Most likely cause | First command or action |
|---|---|---|
error: more than one device/emulator | Multiple phones or emulators connected | Run adb devices and pass -s <serial> |
device unauthorized | RSA debugging prompt not accepted on phone | Unlock phone, tap Allow, or revoke USB debugging authorisations |
device offline | Stale daemon or flaky USB cable/hub | Unplug/replug, run adb kill-server && adb devices |
INSTALL_FAILED_UPDATE_INCOMPATIBLE | Existing app signed with a different key | Run adb uninstall <package> first, then reinstall (adb install) |
no permissions (missing udev rules?) | Linux user lacks USB vendor rule | Add udev rule in /etc/udev/rules.d/51-android.rules and reload |
ADB and Google's Android CLI
In 2026 Google added Android CLI, a command-line tool for building and running Android apps from a terminal or from an AI agent, with commands such as android run and android screen capture. Google describes it as a way to build Android apps with any tool or agent; adb stays the general tool for the phone itself, with its files, settings, other apps and system log. Google's Android CLI documentation has the details.
Questions
What is the Android Debug Bridge used for?
Developers and testers use ADB to install and remove apps, read the system log, copy files, record the screen and run shell commands on a phone or emulator from a computer. Tools such as Android Studio, scrcpy and BenchFleet use it to talk to phones.
How do I get the Android Debug Bridge?
Download Android SDK Platform-Tools from Google's Android developer site, unzip it, and run adb from that folder or add the folder to your PATH. On a Mac, Homebrew installs it as android-platform-tools; on Debian and Ubuntu, the adb package does.
Should I leave USB debugging on or off?
Turn it off on your own phone when you do not need it, because a computer you have allowed can install apps and read data through it. On test phones that stay connected to your own computer, leaving it on is normal.
Can I unlock a phone with ADB?
Not one you cannot get into. ADB works only after USB debugging has been turned on and the computer allowed on the unlocked phone, so it is no way around a forgotten PIN, pattern or password. Unlocking the bootloader is a different thing, done with fastboot, and it erases the phone.
What is the difference between adb and adb shell?
adb commands run on your computer and talk to the phone, such as adb install or adb pull. adb shell opens a command line on the phone itself, where Android's own tools such as pm, am, input and settings run.
Why is adb not recognized as a command?
Your terminal cannot find the adb program. Run it from the platform-tools folder (in PowerShell as .\adb), or add that folder to your PATH and open a new terminal.
Can I use ADB without a computer?
ADB runs on a computer and talks to the phone. A few apps run commands on the same phone through Wireless debugging, but installing builds, collecting logs and copying files from a computer all need adb on that computer.
How do I connect over Wi-Fi and choose one phone?
On Android 11 and newer, turn on Wireless debugging, pair once with adb pair and the pairing code, then run adb connect with the phone's IP address and port. With several phones connected, put -s and the serial number from adb devices before the command; a phone on Wi-Fi has its IP address and port as its serial.
How do I capture logs to troubleshoot a problem on the phone?
Clear the log with adb logcat -c, make the problem happen, then save the log with adb logcat -d > log.txt. Add *:E to keep only errors, or -b crash for crash reports, and use adb bugreport when a developer needs everything.
Can I run ADB commands on several phones at once?
Yes. Each command goes to one phone, chosen with -s and its serial number, so you repeat it for each phone or run it in a loop over adb devices. The ADB command builder writes that loop for bash and PowerShell, and BenchFleet runs group actions on many phones for you.
Start with the Free plan
Free for up to 3 phones, with no account. Pro adds workflows, schedules and AI for up to 25 phones from $16 a month + VAT (including 300 cloud phone minutes every month).
- A Free plan with no time limit and no account
- Starts in Local mode, with no telemetry or analytics in the app