ADB Shell on Android: Complete How-To Guide
In this article
ADB shell gives you direct command-line access to your Android device from a computer, letting you run commands, inspect system logs, and manage apps in ways the normal interface doesn't allow. You'll need a Windows, macOS, or Linux computer, a USB cable (or Wi-Fi), and a few minutes to set it up. This guide walks you through enabling Developer Options, installing ADB, and running your first shell commands.
What You'll Need
- An Android phone or tablet (any recent version, 4.0 and up works).
- A computer (Windows, macOS, or Linux).
- A USB cable that supports data transfer (not just charging).
- Android SDK Platform Tools (free, official download).
- USB drivers for your device on Windows (most modern devices work without extra drivers, but some brands like Samsung or Xiaomi may need theirs).
Step-by-Step
- Enable Developer Options on your Android device: Open Settings > About phone and tap Build number seven times. You'll see a message like "You are now a developer!" This step is required to unlock the hidden developer settings.
- Turn on USB Debugging: Go back to Settings > System > Developer options (the path may differ slightly on some devices, but it's usually under System or Additional settings). Find USB debugging and toggle it on. Confirm any prompt that appears.
- Install ADB on your computer: Download the official Platform Tools from the Android developer website (developer.android.com/tools/releases/platform-tools). Extract the ZIP to a folder you can easily find, like C:\adb on Windows or ~/adb on macOS/Linux.
- Open a command prompt or terminal in that folder: On Windows, hold Shift and right-click inside the extracted folder, then choose "Open PowerShell window here" or "Open command window here". On macOS/Linux, open Terminal and navigate to the folder using
cd(e.g.,cd ~/adb). - Connect your Android device to the computer via USB: Use a cable that supports data transfer. If your device prompts "Allow USB debugging?", check "Always allow from this computer" and tap Allow.
- Verify the connection: In the command prompt, type
adb devicesand press Enter. You should see a list with your device's serial number and the status "device". If it says "unauthorized", re-check the on-screen prompt on your phone. - Start the shell: Type
adb shelland press Enter. Your prompt will change to something likeandroid:/ $— you're now inside the Android command line. - Run basic commands: Try
lsto list files in the current directory,pwdto see where you are, andwhoamito see which user you're running as (usuallyshell). To exit the shell, typeexitor press Ctrl+D. - Use common shell commands: For example,
getprop ro.product.modelshows your device model,dumpsys batteryshows battery status, andpm list packageslists all installed apps. You can also runadb shellfollowed by a command directly, likeadb shell getprop ro.build.version.releaseto get the Android version without entering the shell.
Common Mistakes
- Forgetting to enable USB debugging — without it, ADB won't see your device.
- Using a charge-only cable — some cables lack data lines; try a different cable.
- Not accepting the "Allow USB debugging" prompt on your phone — if you miss it, disconnect and reconnect.
- Running ADB from the wrong folder — you must be in the directory containing
adb.exe(Windows) oradb(macOS/Linux). - Typing commands with typos — ADB is case-sensitive, so
ADBwon't work; use lowercase.
Tips
- Add ADB to your system PATH to run it from any folder — on Windows, search "Environment Variables" and add the folder path; on macOS/Linux, add
export PATH=$PATH:/path/to/platform-toolsto your shell profile. - Use
adb shellwith a single command to avoid entering an interactive session, e.g.,adb shell date. - For wireless debugging on Android 11+, you can use
adb pairandadb connectover Wi-Fi, but USB is more reliable for beginners. - If you have multiple devices, add
-sbefore the command, e.g.,adb -s ABC123 shell. - Learn a few safe commands:
topshows running processes,df -hshows storage, andlogcatshows system logs (press Ctrl+C to stop).
Troubleshooting
If adb devices shows nothing: First, check your USB cable and port. Restart ADB server with adb kill-server then adb start-server. On Windows, try installing the manufacturer's USB drivers. On Linux, you may need to add a udev rule for your device — check the device's vendor ID with lsusb and create a rule in /etc/udev/rules.d/.
If the device shows "unauthorized": Disconnect the USB, re-enable USB debugging (toggle it off and on), then reconnect. When the prompt appears on your phone, tap Allow and check "Always allow".
If adb shell gives "error: device not found": Ensure the device is still connected and the screen is unlocked. Some devices lock ADB when the screen is off or locked — keep your phone awake.
If commands like pm list packages return errors: You might be running as a restricted shell user. Some commands require root access, but avoid rooting your device — it's not necessary for most tasks. The standard shell user can run many read-only commands.
If ADB is not recognized as a command: You're likely not in the correct folder, or the PATH isn't set. Navigate to the platform-tools folder and try ./adb on macOS/Linux or adb.exe on Windows.
Frequently Asked Questions
Is ADB shell safe to use?
Yes, for everyday commands like checking battery or listing apps. However, avoid running commands you don't understand, as some can modify system settings or delete data. Stick to read-only commands until you're confident.
Do I need root access to use ADB shell?
No, most ADB shell commands work without root. Root is only needed for system-level modifications, and rooting your device voids warranty and carries security risks — it's not recommended for normal use.
Can I use ADB over Wi-Fi?
Yes, on Android 11 and later you can use wireless debugging. Enable it in Developer options, then use adb pair with the IP and port shown on your phone. On older versions, you can use adb tcpip 5555 after a USB connection, but it's less secure and resets on reboot.
What's the difference between adb shell and adb commands?
adb shell opens an interactive terminal on your device. Commands like adb install or adb push run directly from your computer without entering the shell. You can also run a single command with adb shell .
How do I exit the ADB shell?
Type exit and press Enter, or press Ctrl+D. If the shell freezes, press Ctrl+C to interrupt the current command, then try again.
Can I use ADB shell to backup my apps?
Yes, you can use adb backup (for apps that allow it) to create a backup file on your computer. However, many apps block this for security. Alternatively, use the built-in backup feature in Settings.