Monday, September 20, 2021
How-tos

List of Useful ADB and Fastboot Commands for Android


List of Useful ADB and Fastboot Commands for Android

People who are used to rooting their Android devices or customizing it will be well aware of ADB and fastboot. These are system utilities that provide access to the backend of Android when it is connected to a PC. These are also one of the constants in the Android ecosystem. Same commands will produce the same results regardless of the device you have, in most cases. ADB or Android Debug Bridge can be used when the Android device is turned on while Fastboot can be used while the device is powered off. Today we’ll take a look at some useful ADB and Fastboot commands.

Requirements

Before you can make use of ADB commands, you’ll have to enable USB debugging on your Android device. The option is found in the Developer options but if you don’t know how to get there, you can follow the tutorial linked below.

List of ADB Commands

As mentioned earlier, ADB commands are used when the device is powered on and you have access to the device. That is, you can unlock the device and grant adb debugging permission to the computer. Listed below are some of the most common and useful adb commands that you may need at some point.

  • adb help – Displays the Help Documentation on ADB commands.
  • adb devices – Shows all the devices connected to adb. Can be used to make sure your device s connected properly before performing any other operations.
    ADB and Fastboot Commands
    adb devices
  • adb reboot: ADB can be used to reboot your device, useful when your hardware buttons aren’t working or if you’re already using ADB. You can also reboot directly into the recovery or bootloader using this command.
    • adb reboot bootloader: Reboots the device to fastboot or bootloader mode.
      ADB and Fastboot Commands
      adb reboot bootloader
    • adb reboot recovery: Reboots the device into recovery mode.
  • adb install <path to APK file>: Can be used to install an APK file on your Android device from your computer. It is more convenient than the alternative, which is to transfer the APK to the device and then install it. This command is generally used by developers or debuggers.
  • adb uninstall <package.name>: This command can be used to uninstall an installed app, which is pretty clear from the command itself.
  • adb logcat: Displays the log data onto the screen.
  • adb bugreport: Displays the dumpsys, dumpstate and logcat data on the screen.
  • adb jdwp: Lists the JDWP (Java Debug Wire Protocol) processes on the device. if you’re not already aware of it, chances are you don’t have to worry about it either.
  • adb get-serialno: Displays the adb instance serial number string with the device.
  • adb get-state: Shows the status of the device.
  • adb wait-for-device: This command is used to program delay before next command is issued. It executes when the device is online but it can be programmed to wait till another process is done.
  • adb start-server: Starts the adb server process.
  • adb kill-server: Stops the adb server process.
  • adb shell: Starts the remote shell command console in the device and lets you control the device through it.
    • adb shell wm density (dpi): Allows you to change the pixel density of the phone display without any hassles.
    • adb shell pm uninstall -k –user 0 <name of package>: Lets you uninstall system apps. This is the command that we use to debloat an Android device.
  • adb sideload (path to update.zip): Just as you can flash zip packages from a custom recovery, you can also do it via adb sideload, provided the recovery supports it. TWRP recovery which is the most common custom recovery for all devices does support it. This way you can flash packages directly from your computer without having to transfer them first to your device or any external storage.
  • adb pull [mention the path to file on device] [mention path to any destination folder on your Windows]: This command can be used to pull any files from your device and save it on your computer.
  • adb push: Similarly, this command can be used to push a file from your computer to your device.
ALSO READ  How to take a screenshot privately on chat without being detected

List of Fastboot Commands

These commands can be used only when the device is in the fastboot mode. You can try a button combination to put your device into this mode or use the adb command mentioned above.

adb reboot bootloader

Once in fastboot mode, you can use a number of fastboot commands as mentioned below.

  • fastboot devices: Displays all the connected devices. Can be used similarly as the adb devices command to make sure the device is properly connected.
    ADB and Fastboot Commands
    fastboot devices
  • fastboot oem unlock: Unlocks the bootloader on some Android devices such as Pixel or OnePlus. Most other Android devices require you to get an unlock key from the OEM.
  • fastboot oem lock: Used to relock the bootloader of your device.
  • fastboot reboot bootloader: Reboots the device from the fastboot mode back into fastboot mode. Sometimes this may be necessary when you’re flashing things in the fastboot mode.
  • fastboot flash: This command can be used to flash things onto your device.  This can be a zip file, a boot image or a recovery image.
    • fastboot flash boot boot_image.img: Flashes a boot image to your device.
    • fastboot flash recovery recovery_image.img: Flashes a recovery image to your device.
  • fastboot boot image_file.img: This command can be used to boot your device using a certain image file without having to flash it first. Can be useful to test an image before flashing it.



READ SOURCE

Leave a Reply

This website uses cookies. By continuing to use this site, you accept our use of cookies.