
ADB commands for Android: Learn how Android Debug Bridge (ADB) connects a computer to an Android phone for installation, diagnostics, logs and device control. This guide explains what each command does, its syntax, practical examples, useful options, and common mistakes. Commands are shown for typical installations; flags can vary across operating-system and tool versions.
Before you start
Open a terminal appropriate for the operating system shown in the examples. Check that the required tool is installed and that you are running it with the permissions needed for your task. Replace sample names, paths, hostnames and IDs with values from your own environment.
Syntax at a glance
Square brackets usually indicate optional arguments, while uppercase words such as FILE, HOST and PACKAGE are placeholders that you replace. Keep quotes around paths or text that contains spaces. Commands should be tested on a safe sample before being used in production.
Quick command reference
| Command | What it does | Example | Useful options |
|---|---|---|---|
adb devices | List Android devices visible to ADB | adb devices -l | -l prints extra device details; authorize the computer on the phone |
adb shell | Open a shell on the connected Android device | adb shell getprop ro.build.version.release | Use a command after shell to run one operation remotely |
adb install | Install an APK on the device | adb install app-release.apk | -r replaces an existing app while retaining its data where allowed |
adb logcat | Read Android system and app logs | adb logcat -d > device-log.txt | -d dumps current logs and exits; -c clears logs |
adb reboot | Restart the connected device | adb reboot | Targets such as bootloader/recovery are device-dependent |
Command syntax and examples explained
1. adb devices
Purpose: List Android devices visible to ADB.
Syntax
adb devicesExample
adb devices -lOptions and notes: -l prints extra device details; authorize the computer on the phone.
A device marked unauthorized needs you to approve the RSA prompt on the phone.
2. adb shell
Purpose: Open a shell on the connected Android device.
Syntax
adb shell [COMMAND]Example
adb shell getprop ro.build.version.releaseOptions and notes: Use a command after shell to run one operation remotely.
ADB shell commands run on the device, not on your computer.
3. adb install
Purpose: Install an APK on the device.
Syntax
adb install FILE.apkExample
adb install app-release.apkOptions and notes: -r replaces an existing app while retaining its data where allowed.
Only install APKs from sources you trust.
4. adb logcat
Purpose: Read Android system and app logs.
Syntax
adb logcat [FILTER]Example
adb logcat -d > device-log.txtOptions and notes: -d dumps current logs and exits; -c clears logs.
Review logs for crash messages; redact tokens or personal data before sharing.
5. adb reboot
Purpose: Restart the connected device.
Syntax
adb reboot [bootloader|recovery]Example
adb rebootOptions and notes: Targets such as bootloader/recovery are device-dependent.
Save work before rebooting; recovery and bootloader modes have different behavior.
Common mistakes and troubleshooting
- Command not found: confirm the tool is installed and available on your PATH; open a new terminal after changing PATH.
- Permission denied: verify the current account, file permissions and target path. Use administrator/root privileges only when genuinely required.
- Unexpected output: check the command version, quoting, current directory and exact arguments. Consult the local help or manual for options supported by your build.
- Destructive operations: preview the target and keep a backup before deleting data, rewriting history, flashing a partition or changing system configuration.
Safety tips
Review every command before running it, especially commands that delete files, change permissions, flash firmware, alter a database or expose a network service. For network scanning and remote administration, work only on devices and systems you own or are authorized to test. Keep credentials, private keys, access tokens and log files private.
Frequently asked questions
Do these commands work on every system?
Not always. Some commands are specific to Windows, Linux, Android, a particular package manager or an installed tool version. Use the syntax shown for your platform and check local help when a flag is unavailable.
Can I copy and run every example exactly?
Use the examples as templates. Replace placeholders such as filenames, package IDs, hostnames and paths with your own values, and verify the effect before executing a command that changes data or system state.
Conclusion
Use this reference as a starting point, then confirm flags in the tool’s official help or manual for your installed version. A clear understanding of syntax, options and side effects makes command-line work more reliable.