If you are a pro-Android user and uses their phone for customizations, rooting or unlocking bootloaders, then you must be aware of the term ADB and fastboot. Basically, ADB and fastboot is a command-line tool through which you can modify a lot of things on your Android phones. For instance, you can give or revoke read and write permission for a package, you can use ADB commands to unlock the bootloader of your smartphone and many more. There are other many ADB commands through which you will actually be able to explore the full potential of Android OS and your smartphones.
Most of the users who use ADB knowingly or unknowingly only uses a limited set of commands and does not use the full potential of the ADB tool. ADB stands for Android debug bridge and it consists of 3 components.
- Client- It is the laptop or your PC to which the Android device or the emulator is connected to.
- Daemon – It is a service that runs on an Android device and your computer as well, it is used to facilitate command execution and acceptance between the devices. It is also known as ‘adb‘.
- Server – Server is the interface to handle the communication between Client and Daemon.
Do note that before using ADB and fastboot tools, make sure that you have the latest version of the driver for your Android device and the latest version of SDK Platform-tools are installed on your computer.
ADB Commands List Directory
Make sure before you try these ADB commands on your Android device, you have allowed the USB debugging option for Developers options from settings. Also, you have given authorization access to your computer from your phone. To enable USB debugging you need to go to the developer’s options from settings which can be enabled by tapping7 times on the build number. To give authorization access to your computer you need to plug your phone after enabling USB debugging and open ADB command-line. Write ‘ adb devices you must see a pop-up on your phone asking for permission click on allow and that’s it. Also, make sure you do all these experiments on a backup phone and not on a daily driver, as one wrong code or command can cause your phone to brick or malfunction.
Now you are good to go and can test ADB commands. Below we have some ADB commands through which you can reboot your phone, sideload APKS, flash flashable zips, push or pull files, uninstall apps, debloat your phone and many more such operations.
This is a very basic command and writing will show you the ADB versions and all the possible commands associated with ADB.
This is one of the very first commands which we all use while using ADB tools. By writing adb devices we can check the list of devices connected to the computer and can communicate to ADB commands. We can use this command to check if the device is connected properly and all the necessary devices are installed. You can also write ‘ adb devices -1′ to get the list of devices by model or product number.
adb connect ip_address_of_device
This command is used to find out the IP address of the Android device that is connected to your PC.
As the name says it all, this command can be used to display the user manual of ADB commands, it can show some of the commands as well.
adb version command to check the version of ADB driver installed on your computer, comes in handy when you want to confirm if you have the latest version installed or not.
One of the very common commands of adb tool is the adb reboot it is used when you want to reboot your device. With the help of this command, you can even reboot your device into fastboot, bootloader or even recovery. This command comes in handy when the device’s hardware keys are not functioning properly, or if you really don’t want to touch your device.
adb reboot bootloader
use this command to directly reboot your device into bootloader, make sure your device is connected to your PC. Just type
adb reboot bootloader and your device will reboot into bootloader.
adb reboot recovery
use this command to directly reboot your device into recovery, make sure your device is connected to your PC. Just type
adb reboot recovery and your device will reboot into recovery.
Android is an Open Source OS and is very vast. Until now you might know only two methods of installing Android apps on your Android device. You either download it from Google Play Store or galaxy Store, or else you download the APK and manually install it. However, you can also install apps using adb commands-line as well. With the help of this command, you can directly install the APK from your PC to your Android device, without copying or doing anything else. Just copy the APK file to the SDK platform-tools folder and then type the adb install package name and that’s it. Below is an example of how to write code, it can vary from app to app and package to package.
adb install com.facebook.katana.apk
You can also re-install an APK on your Android device without deleting the data of the App. Just write the below command.
adb install -r com.facebook.katana.apk
There are some apps and games that support SD card installation. So to install or move an APK on to SD card directly using the adb command-line, write the code mentioned below.
adb install -s com.facebook.katana.apk
adb install –k <add the path of the .APK file on your computer>
To uninstall an app from your Android device just use this command, and your app will be uninstalled.
adb uninstall com.facebook.katana
However, if you want to delete the app but wants to keep the data of the app, then simply use the adb uninstall command with the “-k” parameter, below is an example for the same.
adb uninstall -k com.facebook.katana
To know about the Android device or the emulator connected to your Windows, Mac or Linux computer, simply use the
adb usb command and it will get you all of the info.
adb logcat is a command which is used to track the log data of your Android device or the emulator. With the
adb logcat command, you will be able to see the log data of your device on your PC. There are a few parameters as well which can be used like ‘ adb logcat -c // clear // with this you will be able to clear all the existing logs of your Android phone or tabler or the emulator. To save the logcat data of your Android device or emulator on your PC use the following command.
adb logcat -d > [path_to_file] //
adb start-server command is a very useful command and it is used to start the adb server. Without the adb server no command will work properly, so in case the server is not responding or by chance, it has stopped, you can use this command to start the server again.
if the ADB command line is not working properly, and even after restarting the terminal doesn’t help you. Then you must try to stop the adb server and start it again, so just use the command
adb kill-server and then use the above-mentioned command to start the server again.
Another yet very powerful and common command is the
adb sideload command. It can be used to sideload software and OS update.zip files using a computer. If you have downloaded a flashable update.zip file then you need to copy it to the platform-tools folder and then execute the command as written below. For ease, rename the downloaded flashable zip file into an update.zip file.
adb sideload update.zip
To download or pull files stored on your Android device to your computer, simply use the
adb pull command. It can be helpful to pull any files from your device and save them to the platform-tools folder on your computer.
adb pull /sdcard/img_001.jpeg
Similar to adb pull command this
adb push command can be used to push a file from your computer to your device. Do note that whichever file you need to transfer to your Android device from your PC, you need to copy it to the platform-tools folder first. You can also push the files from your Pc to the sd card of your Android device directly. Below is the command to push a file from your PC to the sd card of your Android device.
adb push com.whatsapp.apk /sdcard
adb backup //
This is a very simple and handy command, it basically takes a full backup of your Android device to your computer.
adb restore //
Similar to the above-mentioned command, with the help of the
adb restore // command you will be able to restore all of the data from a backup you already created using the adb backup command.
Since Android OS uses a lot of codes to run, often we cross through a lot of bugs. So with the help of this
adb bugreport command, you will be able to see the log data, dump state and dumpsys from your Android device to your computer. Often OEMs asks for bug reports, and this how you can send them or show them the bug you are facing on your Android device.
The term JDWP stands for Java Debug Wire protocol. With the help of this ADB command, you will be able to see the list of all the JDWP processes on your PC.
To get the ADB instance serial number, use the
adb get-serialno command.
adb get-state command is used to see the ADB status of a connected device or emulator.
adb wait-for-device is a command that tells ADB that it has to wait and keep the connection on hold until the next command is being issued or executed.
That was an extensive cheat sheet regarding the ADB commands and, we hope it was a helpful article for you, as ADB commands come in handy a lot of times while experimenting with something with our devices, or while restoring our devices. We will keep on updating ADB commands as we get hands-on more commands of ADB.