Introduction
Android Debug Bridge (adb) is a versatile command-line tool that lets you communicate with a device. It is a client-server program that includes three components: a client, a daemon, and a server. The client runs on your development machine. The daemon runs as a background process on the device. The server runs as a background process on your development machine.
Using adb, you can perform a variety of device actions, such as installing and debugging apps, and it provides access to a Unix shell that you can use to run a variety of commands on a device. In this tutorial, we will show you how to install and use adb in Linux.
How To Install and Use Android Debug Bridge (adb) in Linux
1. Install the Android SDK Platform-Tools package:
The Android Debug Bridge (adb) is a command-line tool that lets you communicate with a device. The adb command facilitates a variety of device actions, such as installing and debugging apps, and it provides access to a Unix shell that you can use to run a variety of commands on a device.
To install the Android SDK Platform-Tools package for your Linux distribution, use the following command:
sudo apt-get install android-sdk-platform-tools
2. Set up the adb environment:
Once the Android SDK Platform-Tools package is installed, you need to set up the adb environment. To do this, open a terminal window and enter the following command:
export PATH=$PATH:/path/to/android-sdk-platform-tools
Replace /path/to/android-sdk-platform-tools with the actual path to the Android SDK Platform-Tools package.
3. Connect your device to your computer:
Connect your Android device to your computer using a USB cable.
4. Verify that your device is connected:
To verify that your device is connected, enter the following command in the terminal window:
adb devices
If your device is connected, you should see its serial number in the output.
5. Use adb commands:
Now that your device is connected, you can use adb commands to perform various tasks on your device. For example, you can use the adb install command to install an app on your device.
For a full list of adb commands, enter the following command in the terminal window:
adb help
Android Debug Bridge (adb) is the most used command-line tool that enables communication between a personal computer and a connected Android-powered device or emulator instance over a USB cable or TCP/IP (wirelessly).
It supports various device actions such as networking, scripting, installing and debugging apps, and file transfer. It also provides access to a Unix shell that can be used to run a variety of Linux commands on a device.
adb is a client-server tool that includes three main components:
- a client that runs on your development machine and sends commands. You can execute it from a command line by running an adb command.
- a daemon (adbd) that runs as a background process on each device and executes commands on a device.
- a server that manages communication between the client and the daemon, it runs as a background process on your development machine.
The adb command-line tool ships with the standalone Android SDK Platform Tools package, a component of the Android SDK. Let’s look at how to grab and install the latest version of the Android SDK Platform Tools package in Linux.
Install Android Debug Bridge (adb) in Linux
To install the adb package, run the appropriate command for your Linux distributions, as follows:
$ sudo apt install adb [On Debian, Ubuntu and Mint] $ sudo yum install adb [On RHEL/CentOS/Fedora and Rocky/AlmaLinux] $ sudo emerge -a dev-util/android-tools [On Gentoo Linux] $ sudo apk add adb [On Alpine Linux] $ sudo pacman -S adb [On Arch Linux] $ sudo zypper install adb [On OpenSUSE]
Note: If you wish to use the latest version of adb, move to the next section to download and set up the latest binary from the Android SDK Platform Tools package release.
Install Android SDK Platform Tools in Linux
You can download the most recent version of the Android SDK Platform command-line tools from the SDK Platform Tools release page. Alternatively, run the following commands to download the archived package, extract it, and move into the extracted folder:
$ mkdir cli-tools $ wget -c https://dl.google.com/android/repository/platform-tools-latest-linux.zip $ unzip platform-tools-latest-linux.zip $ cd platform-tools/
After extracting the archive file, you can list the content of the extracted folder and the adb command should be in there as shown in the following screenshot:
$ ls
To check the version of the adb command-line tool you have just installed, run the following command:
$ ./adb version Android Debug Bridge version 1.0.41 Version 34.0.1-9680074 Installed as /home/tecmint/Downloads/platform-tools/adb
How to Use Android Debug Bridge (adb) in Linux
In the following examples, we will run the latest version of the adb command installed using the instructions in the previous section.
Once you have adb installed on your Linux system, connect your device to the computer via a USB cable and enable USB debugging in the device system settings, under Developer options.
Next, run the following commands to list the devices connect to the computer, make sure to check on the devices for any prompts to allow access.
$ ./adb devices
From the output of the previous command, the string RZ8NA0V3HEY is created by adb to uniquely identify the device by its port number. The next column shows the device meaning the device is connected to the adb server. Other possible values are offline (device not connected or is not responding) and no device (means no device is connected).
To show more information about the device (device description for example product:a71naxx model:SM_A715F device:a71 transport_id:1), add the -l
flag.
This is useful if many devices are attached to the computer:
$ ./adb devices -l
To install an Android app using adb, use the install sub-command as follows. If you are installing a test app, remember to add the -t
flag:
$ ./adb install ~/MusiX.apk OR $ ./adb install -t /path/to/testapp.apk
If you have multiple devices connected to the computer, use the -s
option to specify the device’s serial number:
$ ./adb -s RZ8NA0V3HEY install ~/MusiX.apk
In case your connection to a device is lost, you can reset your adb host and start over from the beginning:
$ adb kill-server
To view all available command-line options, issue the following command:
$./adb --help
That’s it for now! For more information, check out the online adb documentation, which contains more use cases and command-line examples.
If You Appreciate What We Do Here On Jassweb, You Should Consider:
Jassweb is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit Jassweb! to search or browse the thousands of published articles available FREELY to all.
If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.
We are thankful for your never ending support.
How To Install and Use Android Debug Bridge (adb) in Linux
Android Debug Bridge (adb) is a versatile command-line tool that lets you communicate with a device. The adb command facilitates a variety of device actions, such as installing and debugging apps, and it provides access to a Unix shell that you can use to run a variety of commands on a device. It is a client-server program that includes three components:
- A client, which runs on your development machine. You can invoke a client from a command-line terminal by issuing an adb command.
- A daemon (adbd), which runs on the device.
- A server, which runs as a background process on your development machine. The server manages communication between the client and the adb daemon running on an emulator or device.
Installing adb
The adb tool is located in the platform-tools
directory within the Android SDK directory. To install it, follow these steps:
- Download and install the Android SDK from https://developer.android.com/studio/index.html.
- Open a terminal window and navigate to the
platform-tools
directory within the Android SDK directory. - Run the following command to install adb:
sudo apt-get install android-tools-adb
Using adb
Once adb is installed, you can use it to run commands on your device. To use adb, you must enable USB debugging on your device. To do this, follow these steps:
- Open the Settings app on your device.
- Navigate to the Developer options.
- Enable the USB debugging option.
Once USB debugging is enabled, you can use adb to run commands on your device. To do this, follow these steps:
- Connect your device to your computer using a USB cable.
- Open a terminal window and navigate to the
platform-tools
directory within the Android SDK directory. - Run the following command to list the devices connected to your computer:
adb devices
- Run the following command to run a command on your device:
adb -s [device-id] shell [command]
For example, to list the files in the root directory of your device, you would run the following command: adb -s [device-id] shell ls /
Conclusion
Android Debug Bridge (adb) is a versatile command-line tool that lets you communicate with a device. It is a client-server program that includes three components: a client, a daemon, and a server. To install adb, you must download and install the Android SDK. Once adb is installed, you can use it to run commands on your device by enabling USB debugging and connecting your device to your computer. With adb, you can perform a variety of tasks, such as installing and debugging apps, and running commands on your device.