Android Fastboot Mode Commands with Examples

Author:

Unlock Bootloader:fastboot oem unlock(Allows flashing of custom images. Some devices may require additional steps or confirmation.)
fastboot flashing unlock
Lock Bootloader:fastboot oem lock
fastboot flashing lock
Flash Recovery:fastboot flash recovery <filename>.img(Replaces the current recovery with a new one, usually a custom recovery like TWRP.)
Flash System Image:fastboot flash system <filename>.img(Flashes a new system image, often used to install a new OS version or custom ROM.)
Reboot Device:fastboot reboot(Restarts the device normally.)
Reboot to Fastboot:adb reboot fastboot(Reboots the device into fastboot mode.)
Reboot to Recovery:fastboot reboot recovery
Erase Partition Data:fastboot erase <partition>(Clears data from a specific partition, like userdata, cache, etc.)
Format Partition:fastboot format <partition>
Check Device Connection:fastboot devices(Lists devices connected in fastboot mode.)
Get Device Information:fastboot getvar all(Displays detailed device information like serial number, hardware info, etc.)
Flash Specific Partitions (e.g., Bootloader, Radio):
Bootloader:fastboot flash bootloader <filename>.img
Radio (for devices with separate radio firmware):fastboot flash radio <filename>.img
Boot an Image Temporarily (without Flashing):fastboot boot <filename>.img(Boots an image without flashing it, useful for testing custom recoveries or kernels.)
Set Active Slot (for devices with A/B Partitions):fastboot –set-active=<slot>(Sets the active partition slot to either a or b.)
Flash Multiple Partitions at Once:fastboot -w update <filename>.zip(Flashes all partitions listed in a specified update package, typically used for full OTA updates.)
Display Variable Information (like current slot or partition layout):fastboot getvar <variable>(Examples of <variable>: current-slot, partition-size:<partition>, version-bootloader, version-baseband.)
Resize a Partition (for devices that support it):fastboot resize-partition <partition> <size>(Resizes a specified partition to a new size. Requires compatible firmware and device support.)
Erase Specific User Data (Useful for a Factory Reset):fastboot -w(Performs a full wipe of userdata and cache partitions.)
Enable/Disable Verity (used for device integrity checks):
To disable:fastboot disable-verity
To enable:fastboot enable-verity
Reboot to Bootloader (Useful if chaining commands):fastboot reboot bootloader(Restarts the device back into bootloader mode without fully booting it up.)
Flash a Partition with Sparse Images:fastboot flash <partition> <filename>.img_sparsechunk<N>(Flashes a sparse image chunk by chunk. Often used with images for Moto and Nexus devices.)
Erase Cache Partition:fastboot erase cache(Clears the cache partition, sometimes useful for fixing boot issues.)
Continue Boot (Use if Boot Process is Paused by Bootloader):fastboot continue
OEM Commands (Device-Specific):fastboot oem <command>(For example, fastboot oem unlock-critical to unlock additional partitions on some devices.)
Bootloader Lock Status Check:fastboot getvar unlocked(Checks if the bootloader is currently locked or unlocked.)

For More On Android App Development Visit our Page here