How to install and use ADB and Fastboot on Ubuntu

ADB (Android Debug Bridge) and Fastboot allow us to manage Android mobile devices from the computer. After reading this tutorial, you’ll know how to install and use ADB and Fastboot to control your Android cell phone.

Getting started: Installing ADB, Fastboot, and getting your Android device ready

Before starting, you need to enable your phone Developer Options submenu. I have a Redmi 9 cell phone, but the steps are similar in most Android devices.

To start, on your phone, tap Settings and select About Phone; in the screenshot below, it is the first option; some Android devices have this option at the bottom of the Settings menu.

How to install and use ADB and Fastboot on Ubuntu 1

Tap MIUI Version several times until you see Developer Options are enabled.

How to install and use ADB and Fastboot on Ubuntu 2

Go back to the Settings menu, scroll down to find, and tap Additional Settings.

How to install and use ADB and Fastboot on Ubuntu 3

Would you please scroll down to find Developer options and tap it?

How to install and use ADB and Fastboot on Ubuntu 4

Enable USB Debugging as shown in the following screenshot.

How to install and use ADB and Fastboot on Ubuntu 5

Tap the confirmation box “I’m aware of possible risks, and assume all possible consequences voluntarily” and press OK.

How to install and use ADB and Fastboot on Ubuntu 6

Now you can install ADB and Fastboot from your Ubuntu computer.

First, install Android Debug Bridge and Fastboot using the apt command as shown in the screenshot below.

sudo apt install android-tools-adb android-tools-fastboot -y

How to install and use ADB and Fastboot on Ubuntu 7

To start the ADB server, run the following command.

sudo adb start-server

How to install and use ADB and Fastboot on Ubuntu 8

Your phone device allows USB debugging when requested by tapping OK, as shown in the image below. In some cases, this prompt on the mobile appeared in the next step.

How to install and use ADB and Fastboot on Ubuntu 9

To see if your device was properly detected, you can run the following command.

adb devices

How to install and use ADB and Fastboot on Ubuntu 10

As you can see, the device was detected properly.

You can open a shell on your Android device by running the command below.

adb shell

How to install and use ADB and Fastboot on Ubuntu 11

As you can see, the pwd command shows I’m in the system root directory. The ls command will list all files and directories inside. You can browse all directories using the same Linux syntax.

ls

How to install and use ADB and Fastboot on Ubuntu 12

Transferring files from computer to mobile

The following command shows how to send files from your computer to your mobile device. To do it, you need to run adb with the push option followed by the file you want to copy to your phone and your phone’s path where the file will be stored.

The command below is used to copy the img.jpg file to /storage/sdcard0/Pictures/. You can learn file and directory paths by browsing the shell as explained previously (adb shell).

adb push img.jpg /storage/sdcard0/Pictures/

How to install and use ADB and Fastboot on Ubuntu 13

Transferring files from mobile to computer

You also can copy files from your mobile device by using the pull option as shown in the example below, in which the file img.jpg is copied into the computer’s current directory (.).

adb pull /storage/sdcard0/Pictures/img.jpg .

How to install and use ADB and Fastboot on Ubuntu 14

Installing APK packages

Adb also allows you to install applications on your mobile device. To do it, you need to enable the Install via USB located in the Developer Options submenu in your phone Settings, as shown in the image below.

How to install and use ADB and Fastboot on Ubuntu 15

Once the Install via USB option was enabled, you can install any apk supported package by adding the install option followed by the apk package as shown below.

adb install maildroid_5.05-505_minAPI18.apk

Your phone will request your confirmation, as shown in the screenshot below; tap Install to get the application installed.

How to install and use ADB and Fastboot on Ubuntu 16

If the application were properly installed, you would see the “Success” message shown in the following screenshot.

How to install and use ADB and Fastboot on Ubuntu 17

Uninstalling APK packages

You also can uninstall applications from your mobile device using your computer. Instead of using the install option explained previously, you need to use the uninstall option.

Before uninstalling a package, you need to see its name; you can do it by opening a shell on your Android device and running the command of the example below (replace maildroid with the app name you want to find).

adb shell
pm list packages | grep maildroid

How to install and use ADB and Fastboot on Ubuntu 18

As you can see, the package name is com.maildroid. To remove it, run:

adb uninstall com.maildroid

How to install and use ADB and Fastboot on Ubuntu 19

Additional commands

The following command can be used to change your phone resolution.

adb shell wm size

The command below allows you to edit your mobile’s dpi (dots density or Dots per inch).

adb shell wm density

Stock recovery doesn’t support flashing custom ROMs. The Fastboot command below can be used to install a custom recovery such as CWM or TWRP.

fastboot flash recovery

The command below allows you to fully wipe your mobile to install a custom ROM.

fastboot -w

Conclusion

Both Adb and Fastboot allow users to operate their Android devices from the computer. Learning to use these applications is mandatory for anyone dealing with mobile devices. It is important to highlight that the applications explained in this tutorial are multi-platform, including Linux, MacOS, and Windows. 

I hope this tutorial on Adb and Fastboot was useful. Keep following Linux Hint for more Linux tips and tutorials.

5 thoughts on “How to install and use ADB and Fastboot on Ubuntu”

  1. Have you ever thought about creating an e-book or guest authoring on other sites? I have a blog based on the same ideas you discuss and would really like to have you share some stories/information. I know my viewers would value your work. If you are even remotely interested, feel free to shoot me an e mail.

  2. I’m really impressed along with your writing talents as neatly as with the structure to your blog. Is this a paid subject or did you modify it yourself? Either way stay up the nice high quality writing, it is uncommon to look a great blog like this one nowadays..

  3. Its such as you read my mind! You seem to understand a lot about this, such as you wrote the book in it or something. I feel that you can do with a few p.c. to pressure the message house a bit, but other than that, that is wonderful blog. A fantastic read. I will certainly be back.

Leave a Comment

Your email address will not be published. Required fields are marked *