ADB (Android Debug Bridge) is a command-line tool that lets your computer talk to an Android device for installing apps, copying files, and running shell commands. This article lists the most common ADB commands you will actually use, explains what each one does, and shows the exact syntax with real examples.
What Is ADB and Why Use It?
ADB is part of Google’s Platform Tools, a package that also includes fastboot and other utilities. It works over USB or Wi-Fi and gives you low-level access to an Android device that normal users never see. Developers use it to debug apps, but power users use it to uninstall bloatware, back up data, capture screenshots, and fix stuck devices. The tool runs on Windows, macOS, and Linux, and the same commands work on all three.
ADB uses a client-server architecture: the adb command you type is the client, a background daemon on your computer is the server, and a daemon on the phone (adbd) receives the commands. When you plug in a phone and enable USB debugging, the two daemons connect and the client sends instructions.
Setup: Getting ADB Ready
Before any command works, you need the platform tools and a phone with USB debugging enabled. The steps are the same on every OS:
- Download the official Platform Tools zip from Google’s developer site and extract it to a folder.
- On the phone, open Settings → About phone and tap Build number seven times to unlock Developer Options.
- Go to Settings → Developer options and turn on USB debugging.
- Connect the phone via USB and accept the RSA key fingerprint prompt on the phone.
- Open a terminal in the platform-tools folder and run
adb devicesto confirm the phone is listed as “device”.
If you see “unauthorized” instead of “device”, unplug and replug, then accept the prompt again. If the device shows as “offline”, restart the ADB server with adb kill-server then adb start-server.
Device Connection Commands
These are the first commands you will run and the ones you will use constantly to check the connection.
adb devices– lists all connected devices with their serial numbers and state. The state is either “device” (ready), “unauthorized” (need to accept the prompt), or “offline” (driver or cable problem).adb kill-server– stops the background ADB server. Run this when commands hang or the device shows as offline.adb start-server– starts the server again. Usually not needed because any adb command auto-starts it.adb connect IP:port– connects to a device over Wi-Fi. First you must enable wireless debugging on the phone and pair it, or useadb tcpip 5555over USB once.adb disconnect– disconnects the wireless device.
A common mistake is running adb devices and seeing nothing even though the phone is plugged in. That usually means the USB driver is missing on Windows, or USB debugging is off. On Windows, install the OEM USB driver from the phone manufacturer’s site.
App Management Commands
Installing, uninstalling, and inspecting apps is one of the most frequent uses of ADB.
adb install app.apk– installs an APK file from your computer. Add-rto reinstall keeping data, and-dto allow downgrade.adb uninstall com.package.name– uninstalls an app. Add-kto keep its data and cache on the device.adb shell pm list packages– lists all installed package names. Pipe togrep(Linux/macOS) orfindstr(Windows) to filter:adb shell pm list packages | grep google.adb shell pm path com.package.name– shows the file path of the installed APK on the device.adb shell pm clear com.package.name– clears all app data and cache, like a factory reset for that app.adb shell am start -n com.package.name/.MainActivity– launches a specific activity. You can get the activity name withadb shell dumpsys package com.package.name.
For example, to uninstall a pre-installed app that won’t uninstall from the UI, you would run adb shell pm uninstall -k --user 0 com.facebook.katana. The --user 0 flag removes it only for the main user, which is safer than a full system uninstall.
File Transfer Commands
ADB can copy files both ways, which is handy when MTP (the normal file transfer protocol) is broken or you need to access app-private directories.
adb push local_file /sdcard/– copies a file from your computer to the device. Example:adb push song.mp3 /sdcard/Music/.adb pull /sdcard/photo.jpg .– copies a file from the device to your current folder. The trailing dot means “current directory”.adb pull /sdcard/DCIM/– pulls an entire folder recursively.
Note that the path on the device must be one the shell user can read. For app-private data (like /data/data/com.app), you need root access or use adb backup instead.
Shell and System Commands
The adb shell command opens a remote Linux shell on the device. Anything you can type in that shell is an ADB command when prefixed with adb shell.
adb shell– opens an interactive shell. Typeexitto leave.adb shell dumpsys– dumps system service information. Useadb shell dumpsys batteryfor battery stats,dumpsys meminfofor memory,dumpsys packagefor app info.adb shell screencap /sdcard/screen.png– takes a screenshot and saves it on the device. Then pull it withadb pull.adb shell screenrecord /sdcard/video.mp4– records the screen until you press Ctrl+C. Add--time-limit 10to cap at 10 seconds.adb shell input keyevent 26– sends a key event. 26 is the power button, 3 is home, 4 is back, 24 is volume up, 25 is volume down.adb shell input text "hello"– types text into the focused field. Spaces need%sinstead:input text hello%sworld.adb shell wm size– shows the screen resolution.adb shell wm densityshows the DPI.adb reboot– reboots the device normally.adb reboot recoveryboots into recovery mode,adb reboot bootloadergoes to fastboot.
Many users confuse adb reboot bootloader with adb reboot recovery. Bootloader is the fastboot mode where you flash images; recovery is the separate system for factory resets and OTA updates.
Backup and Restore Commands
ADB has a built-in backup tool that works without root on most devices, though it is deprecated in newer Android versions.
adb backup -apk -shared -all -f backup.ab– creates a full backup of all apps, their APKs, and shared storage into a single .ab file.adb restore backup.ab– restores a backup file to the device.adb backup -f data.ab -noapk com.example.app– backs up only the data of one app without the APK.
These commands will prompt you on the phone to confirm the backup and optionally enter an encryption password. The resulting .ab file is not directly readable; use tools like abe (Android Backup Extractor) to convert it to tar.
Logcat and Debugging Commands
When an app crashes or misbehaves, logcat shows the system log in real time.
adb logcat– streams the entire log. Press Ctrl+C to stop.adb logcat -s TAG– filters by tag. For example,adb logcat -s AndroidRuntimeshows only crash stack traces.adb logcat -d > log.txt– dumps the current log to a file and exits.adb logcat -c– clears the log buffer.
A common misconception is that logcat will show you the reason an app won’t install. It often does, but the easier first step is to run adb install and read the error message it prints, like INSTALL_FAILED_UPDATE_INCOMPATIBLE or INSTALL_FAILED_INSUFFICIENT_STORAGE.
Frequently Asked Questions
What is the difference between ADB and fastboot?
ADB works when Android is running and gives you access to the system shell. Fastboot works when the device is in bootloader mode, before Android boots, and is used to flash partitions like the boot image or recovery. You enter fastboot with adb reboot bootloader, and then use fastboot commands instead of adb.
Do ADB commands require root?
No. Most ADB commands work on a stock, unrooted device as long as USB debugging is enabled. Root is only needed for commands that access protected system partitions or other apps’ private data, like adb shell su.
Can I use ADB over Wi-Fi without a cable?
Yes. On Android 11 and newer, enable Wireless debugging in Developer Options, then pair using adb pair IP:port with the code shown on the phone. After pairing, connect with adb connect IP:port. On older Android, you can run adb tcpip 5555 once over USB, then connect wirelessly.
Why does adb say “device unauthorized”?
This means the phone is connected but you haven’t accepted the RSA key prompt. Unplug, replug, and watch the phone screen for a dialog asking to allow USB debugging. Check “Always allow from this computer” and tap OK.
How do I uninstall a system app with ADB?
Use adb shell pm uninstall -k --user 0 com.package.name. This removes the app for the current user without requiring root. It does not delete the APK from the system partition, so a factory reset will bring the app back.
Is it safe to use ADB commands?
Most commands are safe, but some can cause data loss or boot loops. Avoid adb shell pm clear on system apps, don’t delete unknown packages, and never flash anything unless you know exactly what it is. Always back up important data before using restore or uninstall commands.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Turn Off Backup Encryption in iTunes?
- Campus Tech Innovation Hubs: What They Are
- Poco C51 Airtel Prepaid Locked Variant India?
- Jenkins vs GitHub Actions: Which CI/CD Fits Your Team?
- Shared VPS Hosting: Is It Better?
- Disk Defrag Pro: What It Does and Whether You Need It