
In the world of Android development and customization, ADB and Fastboot commands represent the skeleton keys that unlock the full potential of your devices. Whether you‘re trying to recover a bricked phone, install a custom ROM, or simply remove unwanted bloatware, these powerful command-line tools give you direct access to your device‘s core functions in ways the regular interface never could.
As Android devices have evolved over the past decade, so too have the capabilities of these tools. From basic debugging options in the early days to sophisticated partition management in today‘s devices, ADB and Fastboot have remained indispensable for developers, enthusiasts, and troubleshooters alike.
In this comprehensive guide, we‘ll explore over 60 crucial commands that work across all major desktop platforms – Windows, Mac, and Linux – with particular focus on the system-altering capabilities of Fastboot. You‘ll discover not just what each command does, but when and why you might need it, complete with real-world applications.
The Evolution of ADB and Fastboot
Before diving into commands, let‘s understand the history and significance of these tools in the Android ecosystem.
Historical Development
ADB (Android Debug Bridge) and Fastboot were initially created as developer tools in the early days of Android. Google introduced them as part of the Android SDK to facilitate debugging and system-level modifications:
- 2008: First version of ADB introduced with Android 1.0
- 2009: Fastboot introduced to support direct flash operations
- 2015: Major security overhaul with the addition of RSA authentication
- 2018: Wireless debugging capabilities expanded
- 2020: Wireless debugging became much more accessible in Android 11
What began as purely developer-focused utilities have become essential tools for the wider Android community, enabling everything from simple debugging to complete system recovery and modification.
ADB vs. Fastboot: Understanding the Fundamental Differences
While often mentioned together, ADB and Fastboot serve distinct functions in the Android ecosystem:
Feature | ADB | Fastboot |
---|---|---|
Operating state | Normal Android operation | Bootloader mode |
Primary purpose | Debugging and shell access | Partition writing and flash operations |
Security level | User-level access | System-level access |
Connection type | USB/Wi-Fi | USB only (generally) |
Risk level | Moderate | High (can brick device) |
ADB operates when Android is running normally, providing a communication channel to the device for file transfers, app installation, and shell commands. Fastboot, conversely, works at a much lower level, bypassing the operating system entirely to interact directly with the device‘s bootloader and partitions.
Setting Up ADB and Fastboot Across Platforms
Before using any commands, you‘ll need to properly configure your environment. Let‘s cover platform-specific setup processes in detail.
Windows Setup: Complete Process
Download Platform Tools:
- Visit the official Android developers site
- Download the latest platform-tools package for Windows
Extract and Configure:
- Extract the ZIP to an easily accessible location (e.g., C:\platform-tools)
- Add to PATH by right-clicking "This PC" → Properties → Advanced system settings → Environment Variables
- Under System Variables, find "Path", click Edit, then Add, and enter the full path to platform-tools
Driver Installation:
- For Google devices: Install Google USB Driver
- For other manufacturers: Install OEM-specific drivers from their websites
Verification:
- Open Command Prompt
- Type
adb version
andfastboot --version
- You should see version information rather than "command not found" errors
macOS Setup: Detailed Instructions
Using Homebrew (recommended):
# Install Homebrew if not already installed /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" # Install platform-tools brew install android-platform-tools
Manual Installation:
- Download platform-tools from Android developers site
- Extract to desired location (e.g., ~/platform-tools)
- Add to PATH by editing ~/.bash_profile or ~/.zshrc (for newer macOS):
echo ‘export PATH="$PATH:$HOME/platform-tools"‘ >> ~/.zshrc source ~/.zshrc
Verification:
- Open Terminal
- Run
adb version
andfastboot --version
- Confirm successful installation
Linux Setup: Distribution-Specific Approaches
Debian/Ubuntu:
sudo apt-get update sudo apt-get install android-tools-adb android-tools-fastboot
Fedora:
sudo dnf install android-tools
Arch Linux:
sudo pacman -S android-tools
Manual Installation (for any distribution):
- Download platform-tools from Android developers site
- Extract to desired location (e.g., ~/platform-tools)
- Add to PATH in your shell configuration file:
echo ‘export PATH="$PATH:$HOME/platform-tools"‘ >> ~/.bashrc source ~/.bashrc
USB Configuration:
- Create a udev rules file for proper device recognition:
sudo nano /etc/udev/rules.d/51-android.rules
- Add the following line (replace VENDOR_ID with your device‘s vendor ID):
SUBSYSTEM=="usb", ATTR{idVendor}=="VENDOR_ID", MODE="0666", GROUP="plugdev"
- Apply the new rules:
sudo chmod a+r /etc/udev/rules.d/51-android.rules sudo udevadm control --reload-rules
- Create a udev rules file for proper device recognition:
Preparing Your Android Device
Enable Developer Options:
- Go to Settings → About phone
- Tap "Build number" 7 times
- You‘ll see a message that you‘re now a developer
Enable USB Debugging:
- Go to Settings → System → Developer options
- Enable "USB debugging"
- Optional but recommended: Enable "OEM unlocking" if you plan to unlock the bootloader
Verify Connection:
- Connect your device via USB
- Run
adb devices
- Accept the debugging authorization prompt on your device
- You should see your device listed with "device" status
Essential ADB Commands with Real-World Applications
Let‘s explore the most useful ADB commands organized by their practical applications.
Device Connection and Basic Information
# List connected devices
adb devices
# Check device Android version
adb shell getprop ro.build.version.release
# Get device serial number
adb get-serialno
# Get complete device information
adb shell dumpsys
# Check battery statistics
adb shell dumpsys battery
# View device logs in real-time
adb logcat
System Management and Troubleshooting
# Reboot device normally
adb reboot
# Reboot to recovery mode
adb reboot recovery
# Reboot to bootloader/fastboot mode
adb reboot bootloader
# Reboot to safe mode
adb shell settings put global safe_boot_enabled 1
adb reboot
# Take a bug report (saves detailed system state)
adb bugreport > bugreport.zip
# Check running processes
adb shell ps
# Check memory usage
adb shell dumpsys meminfo
# Force stop an app
adb shell am force-stop com.package.name
File Management and Transfer
# Copy file from computer to device
adb push path/to/local/file /sdcard/
# Copy file from device to computer
adb pull /sdcard/file.jpg path/on/computer/
# List files in a directory
adb shell ls /sdcard/Download/
# Delete a file
adb shell rm /sdcard/unwanted_file.jpg
# Create a new directory
adb shell mkdir /sdcard/new_folder
# Check available storage
adb shell df
App Management and Debugging
# Install an app
adb install path/to/app.apk
# Install app, granting all permissions automatically
adb install -g path/to/app.apk
# Reinstall app, keeping existing data
adb install -r path/to/app.apk
# Install to SD card instead of internal storage
adb install -s path/to/app.apk
# Uninstall an app
adb uninstall com.package.name
# Uninstall app but keep its data and cache
adb uninstall -k com.package.name
# List all installed packages
adb shell pm list packages
# List only third-party packages
adb shell pm list packages -3
# Clear app data
adb shell pm clear com.package.name
# Grant a permission to an app
adb shell pm grant com.package.name android.permission.PERMISSION_NAME
# Revoke a permission
adb shell pm revoke com.package.name android.permission.PERMISSION_NAME
Screen Capture and Recording
# Take a screenshot
adb shell screencap /sdcard/screenshot.png
adb pull /sdcard/screenshot.png
adb shell rm /sdcard/screenshot.png
# Record the screen (stop with Ctrl+C)
adb shell screenrecord /sdcard/video.mp4
# Record at specific resolution
adb shell screenrecord --size 1280x720 /sdcard/video.mp4
# Record with higher bit rate (default is 4Mbps)
adb shell screenrecord --bit-rate 8000000 /sdcard/video.mp4
# Record with time limit (seconds)
adb shell screenrecord --time-limit 30 /sdcard/video.mp4
Wireless Debugging (No USB Cable)
# Connect device via USB and enable wireless debugging
adb tcpip 5555
# Disconnect USB and connect wirelessly
adb connect DEVICE_IP:5555
# Verify wireless connection
adb devices
# Disconnect wireless debugging
adb disconnect DEVICE_IP:5555
# Return to USB debugging mode
adb usb
System Settings Manipulation
# Change screen brightness (0-255)
adb shell settings put system screen_brightness 125
# Change screen timeout (in milliseconds)
adb shell settings put system screen_off_timeout 30000
# Enable/disable auto-rotate
adb shell settings put system accelerometer_rotation 1
# Change animation scales (0.0 to disable)
adb shell settings put global window_animation_scale 0.0
adb shell settings put global transition_animation_scale 0.0
adb shell settings put global animator_duration_scale 0.0
# Set notification volume (0-15)
adb shell media volume --set 7 --stream 5
# Enable/disable Do Not Disturb mode
adb shell settings put global zen_mode 1
Comprehensive Fastboot Commands and Their Applications
Now we‘ll focus on fastboot commands, which operate at a lower level and can fundamentally alter your device‘s system.
Device Information and Status
# Check for connected devices in fastboot mode
fastboot devices
# Show bootloader information
fastboot getvar all
# Check bootloader unlock status
fastboot getvar unlocked
# Show current slot for A/B devices
fastboot getvar current-slot
# Get device product name
fastboot getvar product
# Get device serial number
fastboot getvar serialno
# Get secure boot status
fastboot getvar secure
# Check if bootloader can be unlocked
fastboot flashing get_unlock_ability
Bootloader and Security Operations
# Unlock bootloader (older devices)
fastboot oem unlock
# Unlock bootloader (newer devices)
fastboot flashing unlock
# Unlock critical partitions (some devices)
fastboot flashing unlock_critical
# Lock bootloader (older devices)
fastboot oem lock
# Lock bootloader (newer devices)
fastboot flashing lock
# Generate unlock token data
fastboot flashing get_unlock_data
# Enable OEM unlocking
fastboot oem enable-unlock
# Factory reset via fastboot
fastboot -w
Partition Management
# Erase a specific partition
fastboot erase system
fastboot erase data
fastboot erase cache
# Format a partition with file system type
fastboot format:ext4 userdata
fastboot format:f2fs data
# Erase the frp (Factory Reset Protection) partition
fastboot erase frp
# Wipe all user data
fastboot -w
Flashing Images and ROMs
# Flash boot image
fastboot flash boot boot.img
# Flash recovery image
fastboot flash recovery recovery.img
# Flash system image
fastboot flash system system.img
# Flash vendor image
fastboot flash vendor vendor.img
# Flash custom ROM package
fastboot update rom.zip
# Flash all partitions in single command
fastboot flashall
# Flash radio/modem
fastboot flash radio radio.img
# Flash bootloader
fastboot flash bootloader bootloader.img
Advanced Boot Options
# Boot with custom kernel (temporary)
fastboot boot custom_boot.img
# Boot to recovery (temporary)
fastboot boot recovery.img
# Continue normal boot process
fastboot continue
# Reboot from fastboot to normal mode
fastboot reboot
# Reboot to bootloader
fastboot reboot-bootloader
# Reboot to recovery
fastboot reboot recovery
# Reboot to EDL (Emergency Download) mode
fastboot reboot edl
A/B Partition Management
Many modern Android devices use an A/B partition scheme for seamless updates. These commands are specifically for managing such devices:
# Check current active slot
fastboot getvar current-slot
# Switch active slot
fastboot --set-active=a
fastboot --set-active=b
# Flash to specific slot
fastboot flash boot_a boot.img
fastboot flash boot_b boot.img
# Get slot count
fastboot getvar slot-count
# Check if slot is unbootable
fastboot getvar slot-unbootable:a
Vendor-Specific Fastboot Commands
Different manufacturers implement custom fastboot commands for their devices. Here are some examples organized by manufacturer:
Samsung
# Enter download mode
fastboot oem reboot-download
# Bypass FRP lock (when available)
fastboot oem frp-unlock
# Reset Knox counters (when available)
fastboot oem reset-knox
Xiaomi
# Unlock with Mi account token
fastboot oem unlock UNLOCK_TOKEN
# Anti-rollback check
fastboot getvar anti
# Enter EDL mode
fastboot oem edl
Google Pixel
# Check factory parameters
fastboot getvar all
# Factory reset protection status
fastboot getvar frp-state
# Enable/disable verity
fastboot --disable-verity flash vbmeta vbmeta.img
OnePlus
# Enter fastbootd (newer devices)
fastboot reboot fastboot
# Lock bootloader with token
fastboot oem lock UNIQUE_TOKEN
# Check device tamper flag
fastboot oem device-info
Advanced ADB and Fastboot Usage
Beyond basic commands, ADB and Fastboot can be used for more sophisticated operations.
Automation and Scripting
ADB and Fastboot commands can be combined into scripts