For those who don't know, ADB and fastboot are components of Android SDK and are mostly used by tech geeks like us 😉.
Here, ADB reads for Android Debug Bridge, a command line utility that lets you control your Android device using your computer whereas the fastboot is used to flash your Android device.
When paired together (ADB and fastboot), they make a deadly combination and let you play with your Android device like never before.
So in this tutorial, I will walk you through the following:
- Installation of ADB and fastboot.
- The basic usage of ADB.
Let's start with the installation part.
How to install ADB and fastboot on Ubuntu
To install ADB and fastboot in Ubuntu, all you have to do is execute the following command:
sudo apt install adb fastboot
Once you are done with the installation, you can check the installed version of ADB using the following:
Now, let's have a look at some basic operations you can do with ADB.
How to use ADB in Ubuntu
The first step to use ADB is to enable USB debugging from your Android phone which is found in the developer options.
To get the developer options, go to
About phone and tap on
Build number multiple times and soon you will find the developer options in your settings menu:
Next, go to the developer options and enable the USB debugging:
That's it! Now, connect your Android phone to your computer and start the ADB server using the following command:
sudo adb start-server
Now, your phone will ask you to allow USB debugging for the computer (if you don't see the given prompt, re-enable USB debugging while keeping the phone connected to the computer):
To verify if the phone is connected, list down the devices using the following command:
If your device is connected properly, you'll see a similar output to the above image.
Now, let's have a look at how you can send files between two devices.
How to send files between phone and computer
To send files between two devices, first, you have to get into your Android device's shell using the following:
As the Android itself uses the Linux kernel, you can use all the basic commands such as here, I used the ls command to list files and directories:
Once you find the exact directory where you want to send files, exit from this prompt:
Now, you'd have to use the
adb push command in the following manner to send files from your computer to your Android phone:
adb push Filename /path/to/send/file
For example, here, I've transferred
adb push Sagar.jpg /storage/emulated/0
Pretty easy. Right?
Transfer files from Android to Ubuntu
To transfer files from Android to Linux, you'd have to use the
adb pull command as shown here:
adb pull /path/to/file/in/Android /target
For your reference, I will transfer
/storage/emulated/0 to my home directory:
adb pull /storage/emulated/0/Sagar.jpg .
That was quick 🤯.
This tutorial went through how you can install ADB and fastboot in your Ubuntu machine and use the ADB to transfer files between Android and Linux.
I hope this tutorial gave you an idea of how you can utilize the ADB.
Have more queries or ideas? Drop a comment.