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
RHEL/CentOS/Fedora
OpenSUSE and SUSE Linux Enterprise
Arch Linux
Verifying ADB Installation
Run the following command to verify if the installation was successful:
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:
On many occasions, the ADB server instance may become problematic. You can kill the currently running server using the following command:
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:
Rebooting the Android Device
To reboot the Android device, use the following ADB command:
We can also instruct the device to boot into other modes like recovery, fastboot, etc. To reboot into recovery, use the following command:
To reboot into fastboot, use the following command:
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:
To copy a file from the Android device to the desktop, use the following command structure instead:
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:
We can also check the list of installed apps using the following command:
To uninstall a package, use the following command:
Viewing Logs
Using ADB, we can also access the system log of the Android device. To view the log, run the following command:
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:
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.