Android

How to Install Android Debug Bridge on Linux to Manage your Android Phone

The Android Debug Bridge (ADB, for short) is a versatile command-line tool to communicate with an Android device. Using the ADB, you can perform a variety of actions on the target device, for example, installing and debugging apps, running commands, and more.

In this guide, we will learn how to install ADB on Linux and manage your device with it.

ADB on Linux

There are actually two parts of ADB: one comes with Android and the other one is the desktop client. When the Android device is connected and USB debugging is enabled, we can use the desktop ADB client to send various commands to the Android device. ADB comes as a part of the Android SDK which is available for Windows, Linux, macOS, and others.

However, the ADB tool is also available separately for all the major platforms, including Linux. In most cases, it should be available from the official package repo of the Linux distro.

This guide will feature installation steps on some of the most popular Linux distros.

Installing ADB on Linux

Depending on the Linux distro you are running, follow the proper installation procedure.

Debian/Ubuntu-based distros

$ sudo apt install adb

RHEL/CentOS/Fedora

$ sudo dnf install adb

OpenSUSE and SUSE Linux Enterprise

$ sudo zypper install android-tools

Arch Linux

$ sudo pacman -S android-tools

Verifying ADB Installation

Run the following command to verify if the installation was successful:

$ adb version

Using ADB to Manage Android Devices

To use ADB on a device, you have to make sure that it has USB debugging enabled. Check out this guide that demonstrates how to enable USB debugging mode on your Android device.

Once connected to the computer, we can use the ADB command-line tool to perform various tasks.

Starting/killing the ADB Server

To use ADB, first, we need to launch the ADB server. Run the following command:

$ adb start-server

On many occasions, the ADB server instance may become problematic. You can kill the currently running server using the following command:

$ adb kill-server

Listing Connected Devices

Before trying to push any command to the device, we have to make sure that the ADB server is recognizing the connected device(s) properly. The following command will print a list of all the connected devices:

$ adb devices

Rebooting the Android Device

To reboot the Android device, use the following ADB command:

$ adb reboot

We can also instruct the device to boot into other modes like recovery, fastboot, etc. To reboot into recovery, use the following command:

$ adb reboot recovery

To reboot into fastboot, use the following command:

$ adb reboot fastboot

Note that the fastboot mode is used to flash various system images. To work with your device in fastboot mode, you have to have the fastboot client installed on your desktop.

File Transfer

We can use ADB to perform various common tasks, for example: file transfer.

To copy a file from the desktop to the Android device, use the following command structure:

$ adb push <path_to_file_desktop> <destination_path_android >

To copy a file from the Android device to the desktop, use the following command structure instead:

$ adb pull <path_to_file_android> <destination_path_desktop>

App Management

ADB can install an app on your Android device. However, you need to have the APK package of the app at hand.

The command to install an APK file is as follows:

$ adb install <path_to_apk>

We can also check the list of installed apps using the following command:

$ adb shell pm list packages

To uninstall a package, use the following command:

$ adb uninstall --user 0 <package_name>

Viewing Logs

Using ADB, we can also access the system log of the Android device. To view the log, run the following command:

$ adb logcat

ADB Shell

To get full access to the phone, we can access the ADB shell. It is a direct shell into the Android device, giving us full control over it.

To access the shell, run the following command:

$ adb shell

Android is built on top of the Linux kernel. Practically, you can use most of the Linux tools and commands in the shell to perform various tasks.

Conclusion

ADB is a powerful tool that comes as a part of the Android SDK. In this guide, we demonstrated installing the ADB desktop client on Linux. We also highlighted some common ways of using ADB to perform various tasks on any Android device.

Interested in having Android experience on desktop? Check out some of the best Android emulators for PC. You can also manage most of these emulators through the ADB interface.

About the author

Sidratul Muntaha

Student of CSE. I love Linux and playing with tech and gadgets. I use both Ubuntu and Linux Mint.