Android - What is this `adb` utility I keep getting advice to use?

About adb

To put it shortly, adb (Android Debug Bridge) is a utility made to be installed on a computer, in order to let it gain a shell on a phone that's either connected via USB cable, or on the same Wi-Fi network.

On certain devices running Android Lollipop (5.1.1) and possibly lower versions of the OS, it was possible to trick a device into connecting to itself, since the adb client came bundled in the phone as well. This is not possible any more because, from Android Marshmallow (6.0) onwards, Google removed the adb binary from the phones to reduce the usable attack surface.

It is possible, though, to manually reintroduce the adb client on a phone, without needing to compile the binary yourself. Refer to the adb tag wiki for more info about this topic, as well as about installation on a computer and general troubleshooting.

Where to get it

Some time ago, in order to obtain adb and another utility, called fastboot, one had to download the full Android SDK from Google, if they wanted an official package. Nowadays, a small, official bundle has become available, as XDA says. It includes binaries for the most common operating systems.

How it works

The adb client, installed on your computer, makes a connection to a plugged or otherwise detectable phone, by means of an internal server. Then, the user will be able to send a variety of commands to the phone itself, which will be listened to by adbd, a daemon residing on the phone.

When using adb, you impersonate the user called shell (UID 2000). This user is special, in that they can grant app permissions and access more information than a simple user. This fact, though, does not mean that adb is the same as su, as the latter lets you impersonate any user.

More info about adb and its workings may be obtained by looking at the official documentation.

Issuing commands from a phone

The majority of commands that can be issued via adb tend to be utilities that come preinstalled in a phone.

In order to access them, you need to install a terminal emulator app on your phone (note that Termux is special, in that it specifies its own PATH, thereby ignoring system binaries). This will, for example, let you issue commands such as logcat directly on your mobile device. Remember to omit the adb prefix, though.

It is worth mentioning that, should you lack root permissions, the range of commands you'll be able to execute and the info you'll be able to access will be significantly less than if using adb, because the UID that invokes them will be the app itself, and apps have less permissions than UID 2000.

Android Debugging Bridge (ADB).

It sends commands over USB or Wifi to an android device. It is typically installed on the computer connected to the device. The ADB client can also be run on device itself however the idea is to remotely debug the device.

It is part of the Android Software Development Kit

You can then use the SDK manager to download platform tools.

There is also a more direct link here in case you're just interested in the platform tools

ADB Documentation