Fastboot Commands Explained: getvar, oem device-info and More
Fastboot commands explained: fastboot devices, getvar all, getvar unlocked, oem device-info and flashing get_unlock_ability — what each output means and which are safe.
Updated · 5 min read
In this article
ADB talks to Android while it’s running. Fastboot talks to the phone one level lower — to the bootloader itself, before Android starts. That makes it the most honest source of truth about a phone’s hardware identity and lock state, and also the most dangerous tool in the platform-tools folder if you type the wrong thing.
This guide splits fastboot commands into two groups: read-only commands that are safe to run on any phone you’re inspecting, and write commands that wipe or flash and belong only on your own device. For each read-only command, you’ll see what the output means and what to watch for.
Setup: platform-tools, drivers and fastboot mode
Install fastboot
Fastboot ships in Google’s official SDK Platform-Tools alongside ADB. Unzip it and open a terminal in that folder. In Windows PowerShell, prefix commands with .\ (for example .\fastboot devices). On Windows you may also need the Google USB Driver or your phone maker’s driver before fastboot sees the device.
Enter fastboot mode
- From Android: enable USB debugging and run
adb reboot bootloader. - With buttons: power off, then hold Power + Volume Down on Pixel, Motorola, OnePlus and Xiaomi (variations exist by model).
- Samsung: Galaxy phones don’t use fastboot. They have Download mode, which talks to Samsung’s own tools, so the commands below won’t work there.
You’ll know you’re in the bootloader when the screen shows a text menu or an Android robot with options like Start, Restart bootloader and Recovery mode.
Confirm the connection
fastboot devices
fastboot devices -lYou should see a serial number followed by fastboot. If nothing appears:
- Try a different USB cable and port — charge-only cables are the number-one cause.
- On Windows, open Device Manager. An “Android” device with a warning icon needs a driver.
- On Linux, run with appropriate udev rules or
sudoif your distribution requires it. - Make sure you’re actually in fastboot mode, not recovery.
getvar: reading the bootloader’s variables
getvar asks the bootloader for a named value. It’s read-only and the best place to start.
fastboot getvar all
fastboot getvar product
fastboot getvar serialno
fastboot getvar unlocked
fastboot getvar secure
fastboot getvar version-bootloader
fastboot getvar version-baseband
fastboot getvar current-slotgetvar alldumps every variable the bootloader exposes. The list varies enormously by manufacturer — a Pixel prints dozens, others only a handful.productis the device codename (for example a Pixel codename, or a Xiaomi codename). Search it on the manufacturer’s site to confirm the exact model and that it matches the listing.serialnoshould match the serial in Settings › About phone. A mismatch suggests a replaced board.unlockedreturnsyesorno— the bootloader lock state.securereports whether secure boot is enforced.version-bootloader/version-basebandshow firmware versions. Very old versions on a recent phone mean it hasn’t been updated in a long time.current-slotshowsaorbon phones with A/B seamless updates. Either is normal.
oem device-info and get_unlock_ability
fastboot oem device-info
fastboot flashing get_unlock_abilityoem device-info (some devices)
oem commands are manufacturer extensions, so support varies. On many Qualcomm-based phones — including numerous OnePlus and older Xiaomi models — oem device-info prints lines such as:
- Device tampered: whether the bootloader detected modification.
- Device unlocked:
trueorfalse. - Device critical unlocked: whether critical partitions (like the bootloader itself) can be flashed.
- Charger screen enabled: a harmless setting.
On a Pixel, the command typically returns an unknown-command error. That’s expected — use getvar unlocked there.
flashing get_unlock_ability
Returns 1 if the OEM unlocking switch in Developer options is on (the bootloader may be unlocked) and 0 if it isn’t. On carrier-locked phones it’s often stuck at 0 because the switch is greyed out — see OEM unlocking greyed out. For a buyer, a phone sold as “unlocked” that returns 0 here and no for unlocked is carrier-free at most, never bootloader-free.
Reboot commands
fastboot reboot
fastboot reboot bootloader
fastboot reboot fastboot
fastboot reboot recoveryfastboot reboot returns to Android — always finish an inspection with it. The others restart into the bootloader, fastbootd or recovery. reboot recovery needs a reasonably recent platform-tools release.
Commands you should NOT run on someone else’s phone
| Command | What it does |
|---|---|
fastboot flashing unlock / fastboot oem unlock | Unlocks the bootloader and factory resets the phone. |
fastboot flashing lock | Relocks and wipes. On modified software it can make the phone unbootable. |
fastboot flash <partition> <file> | Writes an image to a partition. A wrong file can brick the phone. |
fastboot erase / fastboot -w | Erases partitions or user data. |
fastboot boot <image> | Boots an unsigned image temporarily (unlocked devices only). |
A safe fastboot inspection, start to finish
adb reboot bootloader(or the button combo).fastboot devices— confirm one device.fastboot getvar productandserialno— confirm identity.fastboot getvar unlockedandflashing get_unlock_ability— confirm lock state.fastboot oem device-infoon supported brands — check “tampered”.fastboot reboot.
Fastboot proves the hardware identity and lock state, but it can’t read the IMEI or carrier records. Dial *#06# once Android is back up. Practice in the terminal below — type help for the list, dial to see every way to read an IMEI, and imei followed by the number to validate it:
Then check the record for the brand: Google Pixel Info, OnePlus Info, Motorola Info or the Xiaomi check, plus a manufacturer and model check and a GSMA blacklist check. For the Android-side commands, read our ADB commands guide, and for what lock states mean, bootloader unlocking explained. The IMEI check guide covers the record side.
Verdict: five read-only fastboot commands tell you a phone’s codename, serial, firmware age and true lock state in under a minute. Keep it to devices, getvar, oem device-info, get_unlock_ability and reboot, and fastboot is completely safe.
Frequently asked questions
What does fastboot getvar all do?
It lists every variable the bootloader exposes, such as product codename, serial number, lock state and firmware versions. It’s read-only and changes nothing.
Why is fastboot devices showing nothing?
Usually a charge-only cable, a missing Windows driver, or the phone isn’t actually in fastboot mode. Try another cable and port and check Device Manager.
What does fastboot flashing get_unlock_ability return?
1 means OEM unlocking is enabled so the bootloader can be unlocked; 0 means it isn’t allowed, often because the phone is carrier-locked.
Does fastboot work on Samsung phones?
No. Samsung Galaxy phones use Download mode instead of fastboot, so fastboot commands don’t apply.
Can fastboot show the IMEI?
Generally no on modern phones. Boot into Android and dial *#06# or check Settings › About phone.
Is it safe to run fastboot commands?
Read-only commands like devices, getvar, oem device-info and reboot are safe. Flash, erase, unlock and lock commands can wipe data or brick the phone.