The Android Debug Bridge (ADB) is a command-line tool to interact with your Android device from your computer. ADB commands enable you to perform a wide range of tasks, including some that would be difficult or even impossible to achieve without ADB. In this article we cover nine essential ADB commands that every Android user should know.
How Do I Set Up ADB?
ADB is distributed via the Android SDK Platform-Tools package. If you have Android Studio installed on your computer, then you can install ABD via the SDK Manager:
1. In the Android Studio toolbar, select “Tools -> SDK Manager.”
2. Find the “Android SDK Platform-Tools” package and select it.
3. Click “OK.”
Android Studio will now download the SDK Platform-Tools package. Alternatively, you can download the standalone Android SDK Platform-Tools package.
To run ADB, navigate to the “platform-tools” folder you just downloaded. This folder should contain an “adb” program.
You’ll need to open a new Terminal or command prompt window and change the directory so it’s pointing at this ADB program. For example, my command looks like this:
You’re now ready to run ADB commands!
1. Show Connected Devices
When using ADB commands, you’ll need to ensure the device you want to interact with is actually connected to your computer. Although ADB has improved significantly in recent years, ADB can sometimes still struggle to “see” connected smartphones or tablets.
The following command will ensure that ABD is ready to communicate with your Android device:
After entering this command, the serial number of your connected devices should appear in the command prompt/Terminal.
If the device doesn’t appear, then make sure you have USB debugging enabled on on your Android device.
2. Reboot Your Device
This command reboots your device in normal mode. You’ll typically run this command after you’ve flashed something to your device and need to reboot.
This command can also be useful if you’re encountering issues with your Android device – for example, if your smartphone suddenly becomes unresponsive.
3. Reboot into Recovery
Android devices have a recovery mode, which is a special bootable partition. If you’re encountering issues with your Android device, then you may be able to fix these problems by booting into recovery mode.
If you wish to reboot your device into recovery mode, then you can issue the following command:
Your device will power down and then reboot into recovery mode. If you’ve flashed a custom recovery on your device, this will load instead of Android’s stock recovery.
4. Reboot into Bootloader Mode
The bootloader is the first thing that runs when you boot up your Android device. If you want to unlock the bootloader, reboot into recovery mode or perform other rooting-related tasks, then you’ll need to boot your device into bootloader mode.
5. Reboot into Fastboot
Android’s fastboot mode helps you flash custom recoveries as well as custom ROMs. Instead of going into bootloader and then choosing fastboot, you can launch directly into fastboot mode using the following command:
6. Send File to Your Device
There are plenty of applications dedicated to helping you transfer files between your computer and your Android device, such as OpenMTP. However, if you just want to transfer the occasional file, then downloading an entire application may feel like overkill.
adb push command lets you send files to your Android device. You just need to specify the source location of the file and the destination where you want to send that file:
For example, you may have a file called “myapplication.apk” that’s stored on your Desktop that you want to push to your smartphone’s “downloads” folder. In this scenario, your ADB command may look something like this:
The file will now be pushed from your laptop or computer and into the “Downloads” folder of the attached smartphone or tablet.
7. Get Files from Your Device
We’ve looked at pushing files, but it’s also possible to pull them. This ADB command lets you pull a file from your Android device so that it appears on your connected laptop or computer.
You just need to specify the file you’re pulling and the location where that file should be stored on your computer:
Let’s imagine that we want to pull a “myphoto.jpg” file from our smartphone or tablet and save it to our Desktop. The command would look something like this:
8. Install an App on Your Device
When you download an application from a source other than Google Play, you may have to push that application from your laptop to your smartphone or tablet as an APK file.
To install an APK file, you just need to specify that APK’s location:
For example, to install an APK named MTE.apk that’s stored on the Desktop, you’d run the following command:
This APK file will then be pushed to Android and installed automatically.
9. Remount the System
Sometimes you may need to remount the entire system of your device. This puts the “/system” partition into writeable mode, and it should be run before pushing any files to this partition. Note that it’s only possible to remount the system on a rooted Android device.
To remount, run the following command:
These are the most common ADB commands that all Android users should know. These commands allow you to install applications, extract files from your Android device, and push files to your smartphone or tablet using a single command. This can save you a considerable amount of time and effort.
ADB commands are also essential if you have any plans to root, hack, or customize your Android device at any point in the future. You may also want to learn how to back up Android data using ADB on Ubuntu or how to uninstall system apps or bloatware without root in Android.