Android has turned out to be the most popular open source operating system for mobile phones. The OS can be customized, modified or even personalized in numerous different ways. Gaining root access has become quite common with Android due to the various privileges that come with it. However, in order to get into Android development, you need to get familiar with ADB and Fastboot commands. So here are the most useful ADB and fastboot commands for you.
ADB, which stands for Android debugging, can be used to issue a set of array commands to your Android device through a terminal or cmd. ADB commands can perform operations like a reboot, sideload OTA updates, install APK files, or even extract system apps.
Fastboot commands can be issued via bootloader or fastboot menu to flash firmware files or custom recoveries. Most common use it to unlock the bootloader of your Android device. These commands can be issued via command prompt or terminal using a Windows PC, Mac or Linux machine.
Warning: If you are not sure about any command, you should refrain from using it. Some of the changes may not be restored. So be cautious.
Most commonly used ADB commands
- adb devices – list all connected devices
- adb reboot – perform a reboot
- adb reboot bootloader – reboot into bootloader or fastboot menu
- adb reboot recovery – reboots into recovery [stock or TWRP whichever is installed]
- adb reboot download – reboots the device into download mode (if available, mainly for LG)
- adb reboot sideload – reboots the device into sideloading menu
- adb sideload <filename with extension> – used to sideload or install OTA updates
adb sideload ota.zip
- adb install – used to install files and applications on Android
For instance- install and apk file
adb install OPFilemanager.apk
While updating and app use the -r switch
adb install -r OPFilemanager.apk
- adb uninstall – used to uninstall APK
adb uninstall <filename>.apk
- adb push <local> <remote> – copy file/dir to device
adb push OPFilemanager.apk sdcard/
- adb logcat – get the full logcat or Android ROM
adb logcat >
- adb pull <remote> [<local>] – copy file/dir from device
adb pull /system/reserve/OPFilemanager/OPFilemanager.apk
List of all ADB commands:
adb devices – list all connected devices
adb push <local> <remote> – copy file/dir to device
adb pull <remote> [<local>] – copy file/dir from device
adb sync [ <directory> ] – copy host->device only if changed
(-l means list but don’t copy)
(see ‘adb help all’)
adb shell – run remote shell interactively
adb shell <command> – run remote shell command
adb emu <command> – run emulator console command
adb logcat [ <filter-spec> ] – View device log
adb forward <local> <remote> – forward socket connections forward specs are one of: tcp:<port>
localabstract:<unix domain socket name>
localreserved:<unix domain socket name>
localfilesystem:<unix domain socket name>
dev:<character device name>
jdwp:<process pid> (remote only)
adb jdwp – list PIDs of processes hosting a JDWP transport
adb install [-l] [-r] [-s] <file> – push this package file to the device and install it
(‘-l’ means forward-lock the app)
(‘-r’ means reinstall the app, keeping its data)
(‘-s’ means install on SD card instead of internal storage)
adb uninstall [-k] <package> – remove this app package from the device
(‘-k’ means keep the data and cache directories)
adb bugreport – return all information from the device
that should be included in a bug report.
adb help – show this help message
adb version – show version num
DATAOPTS: risk factor involved
(no option) – don’t touch the data partition
-w – wipe the data partition
-d – flash the data partition
Scripting: risk factor involved
adb wait-for-device – block until device is online
adb start-server – ensure that there is a server running
adb kill-server – kill the server if it is running
adb get-state – prints: offline | bootloader | device
adb get-serialno – prints: <serial-number>
adb status-window – continuously print device status for a specified device
adb remount – remounts the /system partition on the device read-write
adb reboot [bootloader|recovery] – reboots the device, optionally into the bootloader or recovery program
adb reboot-bootloader – reboots the device into the bootloader
adb root – restarts the adbd daemon with root permissions
adb usb – restarts the adbd daemon listening on USB
adb tcpip <port> – restarts the adbd daemon listening on TCP on the specified port
networking: risk factor involved
adb ppp <tty> [parameters] – Run PPP over USB.
Note: you should not automatically start a PPP connection.
< tty> refers to the tty for PPP stream. Eg. dev:/dev/omap_csmi_tty1
[parameters] – Eg. defaultroute debug dump local notty usepeerdns
adb sync notes: adb sync [ <directory> ]
< localdir> can be interpreted in several ways:
– If <directory> is not specified, both /system and /data partitions will be updated.
– If it is “system” or “data”, only the corresponding partition is updated.
Most commonly used Fastboot commands
Fastboot commands will only work in bootloader or fastboot menu. Issue the following command to reboot into fastboot or bootloader menu.
adb reboot bootloader
adb reboot fastboot
- fastboot devices – lists connected Android devices accessible via fastboot
- fastboot oem device-info – provides bootloader information (locked or unlocked)
Should not use the following, unless absolutely sure!
- fastboot erase system – wipe/erase system
- fastboot erase data – wipe/erase data
- fastboot erase cache – wipe/erase cache
- fastboot flash
- fastboot flash recovery <filename> – flash recovery image
- fastboot flash boot <filename> – flash boot image
- fastboot flash system <filename> – flash system image
- fastboot flash data <filename> – flash data image
- fastboot flash cache <filename> – flash cache image
- fastboot flash userdata <filename> – flash userdata image
- fastboot flash bootloader <filename> – flash bootloader image
- fastboot flash radio <filename> – flash radio image
- fastboot help
List of all fastboot commands
Usage: fastboot [ <option> ] <command>
update <filename> reflash device from update.zip
flashall flash boot + recovery + system
flash <partition> [ <filename> ] write a file to a flash partition
erase <partition> erase a flash partition
getvar <variable> display a bootloader variable
boot <kernel> [ <ramdisk> ] download and boot kernel
flash:raw boot <kernel> [ <ramdisk> ] create bootimage and flash it
devices list all connected devices
reboot reboot device normally
reboot-bootloader reboot device into bootloader
-w erase userdata and cache
-s <serial number> specify device serial number
-p <product> specify product name
-c <cmdline> override kernel commandline
-i <vendor id> specify a custom USB vendor id
-b <base_addr> specify a custom kernel base address
-n <page size> specify the nand page size. default: 2048
How to setup and issue ADB or Fastboot commands via terminal?
The above commands won’t work for Android unless ADB or Fastboot environment is setup on the personal computer. We have already listed a quicker and easier method to setup ADB and Fastboot on Windows, Mac OS, Linux, and Chrome OS.
1. Enable USB Debugging on your device. To do so, go to Settings>About Phone> Tap on the Build Number several times until you get a new Developer Options in the Settings. Open Developer Options and enable USB Debugging from there. Trust the connection by allowing it when you connect it to your PC for the first time.
3. Make sure you have latest device drivers setup on your PC for a better connection. Get it from the official page of your device manufacturer.
Instructions to use ADB and Fastboot commands
Step 1: Go through the prerequisites. Now, connect your Android device to the PC and trust the connection- tap Yes on “Always allow from this computer” when you plug in the device into PC for the first time.
Step 2: Now launch a command prompt or terminal window anywhere. To do so, just click the address bar and type cmd and press Enter key or hold the shift key on the keyboard and right-click on an empty space and select “Open command window here” option to launch a cmd window.
Note: If you have installed the quick ADB installer, it will setup the ADB and Fastboot everywhere on your PC. If you use the minimal ADB package, then navigate to the location where you have setup ADB and Fastboot and launch a command prompt or terminal window there.
Step 3: Now here’s a trick. ADB and Fastboot work in different environments. For ADB commands to work, your devices need to be booted into the system and connected with USB debugging. For Fastboot commands to work, your device must be booted into bootloader or fastboot menu. (You can reboot into bootloader by issuing the following command)
adb reboot bootloader
Step 4: Once in the bootloader, issue the following fastboot command to check connectivity.
Like, share, and follow us on social media. For queries, comment down below.