List of Useful ADB and Fastboot Commands

Useful Fastboot Commands

This tutorial includes a comprehensive list of the most well-known and commonly used ADB and Fastboot Commands. Besides, there are instructions on How to Enable Developer Options and USB Debugging (Android device) are also covered. Well, this tutorial also includes detailed guidance set about the measures to Install ADB and Platform Tools on any PC. In this article, we’ll share with you a list of useful ADB and Fastboot commands that are helpful in many cases.

However, ADB or Android Debug Bridge is a command-line tool and is also a part of the Android Software Development Toolkit. It is frequently used for building a strong connection among PC and devices which then be used for conducting multiple functions. This also includes file installation, rebooting to fastboot or recovery, unlocking the bootloader, and so on.

Honestly speaking, there are tonnes and tonnes of ADB and Fastboot codes, but the majority of them are not yet asked most of the time. Since, rather than dragging this tutorial with unnecessary codes, I would be covering the most important and daily used ones. Plus a description of each code will also be provided side by side. For your ease, the article is divided into two parts. The first one covers the ADB codes while the next one is all about the several Fastboot commands. But before going any further with the process, let’s have a look at the requirements section below.

Benefits of Android SDK

Not all the time, your device shortcut keys will work to let you enter specific interfaces. Like you want to enter the download mode or fastboot mode on your device? And you can’t do that because your device keys are not working, and in most cases, you can’t go into fastboot mode without these SDK commands.

Disclaimer:

Thetechexplained wouldn’t be responsible if anything were to happen to your device if you use these commands for anything. Ensure that all your data is already backed-up so that you won’t lose your important data in case of any problems. Installing a custom ROM requires rooting, which voids the warranty and removes the OEM restrictions on your device. This might lead to a drop in the battery life since you are using your device without any battery restriction. But if you use the custom ROMs battery optimizer, your device can survive a whole day. Installing a custom ROM or custom tweak can damage your device software if not installed correctly.

Install Android SDK

Well, to start with, install an Android SDK Platform Tools on your PC. This is an official ADB, and the Fast-boot binary presented by Google is the only recommended one & approved too. So, download it and extract it to your PC (any suitable location). Doing so will provide you with a platform-tools folder, which will be used during this blog.

Enable USB Debugging and OEM Unlocking

It is necessary to let your device be unlocked when flashing third-party apps and mods. Since bootloader unlocking is not allowed by default from the OEM, it is better to unlock your device from the OEM limitations before proceeding ahead. Most of these devices have the identical OEM unlocking method. Let’s go through the process and see how difficult it is for you.

  1. First of all, you need to navigate to device settings.
  2. Then navigate to About phone and tap the build number 7 times to unlock Developer options.
  3. Open Developer options, and search for USB debugging. Toggle the slider to unlock it. That’ll allow you to flash or unlock your device via fastboot.
  4. Then you can scroll down and tap on OEM Unlocking. Now we can proceed ahead and unlock the bootloader as desired.

Most Commonly Used ADB Commands:

In the first half of the guide, we tried our best to discuss the topic i.e., “Most Important ADB and Fastboot Commands”, we will be concentrating on multiple ADB codes.

Check ADB Connection 

However, to check whether the device is well connected and is in ADB, enter the below code. To get an alphanumeric code with the word ‘device’ next to it (see screenshot below), you can not carry out any further operations. Also, make sure that the device is not identified as ‘unauthorized’. 

ADB Shell Command

To communicate with your device’s operating system, enter the below-mentioned codes. As there are tonnes of adb shell commands, you could find the most significant ones in this tutorial.

adb shell

Reboot to Bootloader/Fastboot Mode

Use the below command to boot a device to Fastboot or Bootloader Mode;

adb reboot bootloader

Reboot to TWRP or Stock Recovery

To boot your device to TWRP or stock recovery from the booted OS, use the mentioned-below command;

adb reboot recovery

Pull Any File via ADB Pull

To ‘pull’ any file from your device and send it to a PC, enter;

adb pull /file-location-on-device/filename

Push files via ADB Push

Likewise, to ‘push’ any file to a device from PC, type;

adb push filename /location-where-file-is-to-be-sent-on-device

ADB Sideload

Using this command, you could flash (install) zip files straight from the command shell, if your recovery helps it (good news- TWRP does support). Simply, boot your device to ‘TWRP recovery’ > Go to ‘Advanced’ > ‘Sideload’ > ‘Swipe to start sideload’. Now enter the below code: 

adb sideload filename

Start ADB Server

Well, to start the ADB server, in case it does not automatically “kills the daemon” and “start on a specific port”, type the below-mentioned command;

adb start-server

Kill ADB Server

If the command tool gets fixed or is not performing as required, you may kill a server by entering the given below code;

adb kill-server

Install APK via ADB Command

To install an APK file on your device, enter the mentioned-below command;

adb install filename.apk

Update APK via ADB Command

To reinstall or update an APK, type the command mentioned below; 

adb install -r filename.apk

Move App to SD Card via ADB

To move an app to sd card (if approved by your device);

adb install -s filename.apk

Uninstall App via ADB Command

To uninstall an APK file on your device, type:

adb uninstall filename.apk

Rare But Important ADB Commands

Here are some other ADB Commands that might come in handy once in a while.

Check Installed Apps via ADB

To list all the app packages names:

adb shell pm list packages

Check System Apps via ADB

To list all the system apps then apply;

adb shell pm list packages -s

Uninstall System Apps via ADB

To uninstall system apps or any bloatware:

adb shell pm uninstall -k –user 0 app-package-name

List All Third-Party Apps via ADB

To list third-party apps installed:

adb shell pm list packages -3

Take a Screenshot via ADB

To capture screenshots from your device;

adb shell screencap /sdcard/screenshot.png

Then, to download captured screenshot to your PC;

adb pull /sdcard/screenshot.png

Delete File via ADB

To delete a file, type;

adb shell
rm -f /sdcard/OPWallpaperResources.apk

Deleter Folder via ADB

To delete a folder, enter the below code;

adb shell
rm -d /sdcard/ZooperWidget

Create New Folder via ADB

To create a new folder on your device, type;

adb shell
mkdir /sdcard/NewFolder

Copy Files via ADB

To copy a file from one location and paste it to another location (on your device), type;

adb shell
cp /sdcard/OPWallpaperResources.apk /sdcard/LiveWallpapers

Move Files via ADB

To move a file from one location to another (on your device), enter the below-mentioned code;

adb shell
mv /sdcard/OPWallpaperResources.apk /system/app

So, this was the first part of the article on ADB and Fastboot Commands. Now, let’s move on to the second half & start with the Fastboot codes.

Most Commonly Used Fastboot Commands

Here are some of the most widely & commonly used Fastboot Commands and they are the following;

Reboot to Fastboot Mode

To reboot your device to fastboot or bootloader mode, enter the below-mentioned code:

adb reboot bootloader

Verify the ADB Connection

When your device is booted to fastboot mode, enter the below-mentioned command to check whether the connection is successful or not. If you see an alphanumeric code and the word fastboot written next to it (see screenshot below), which indicates that your device is successfully connected to fastboot mode. Now, you may try out other fastboot commands.

fastboot devices

Unlock Bootloader via Fastboot

To unlock bootloader type;

fastboot oem unlock

OR

fastboot flashing unlock

Relock Bootloader via Fastboot

To relock the bootloader of your device, type;

fastboot oem lock

OR

fastboot flashing lock

Boot to TWRP via Fastboot

To boot a recovery file on your device, enter the below code;

fastboot boot recovery-name.img

Install File to Boot Partition

To flash (install) a boot file from the command shell, such as flashing magisk patched boot.img, type the below-mentioned code;

fastboot flash boot boot-file-name.img

Install TWRP To Recovery Partition

To flash (install) a recovery file from the command shell to the recovery partition, type the below code;

fastboot flash recovery recovery-name.img

Erase Userdata

To erase all the user data on your device (i.e.formatting the user data partition), enter the following code:

fastboot erase userdata

Erase Everything via Fastboot

This will erase everything from your device type;

fastboot -w

Check Current Active Slot

If you have a dual A/B Partition device, then you could check the current active partition via the following command:

fastboot getvar all

Change Active Partition

If your device is A/B Partition, and you want to switch slots, say from A to B, type the below command;

fastboot set_active b

Reboot to OS from Fastboot

To reboot your device to Android OS, enter the below code;

fastboot reboot

Reboot from Fastboot to Recovery Mode

To Reboot from Fastboot to Recovery Mode, either TWRP or stock, use the below-mentioned command;

fastboot reboot recovery // general command
fastboot oem reboot-recovery // for some devices such as Poco X2

Boot to Fastboot Mode

To boot the device to the newer FastbootD Mode;

fastboot reboot fastboot

Leave a Reply