Since its inception, Android has accustomed its users to a high degree of customization. By customization, we mean alternatives to the system and to the stock options that can be applied both by expert users, through modding procedures, and by passionate users, by installing simple apps.
Speaking of procedures that are relatively more accessible to less experienced users, we are talking about the Android Debug Bridge, which you may know by the name of ADB commands. These represent a way of customizing Android that sits somewhere between modding and interacting with official Android apps.
In this guide, we will immediately see what ADB commands are, what they are for, and then how to install them on your PC with Linux to install apps and services on your Android smartphone or tablet.
Before continuing, we point out that we have created a similar guide also for Windows and macOS.
- What are ADB commands
- What are the ADB commands for
- Preliminary operations
- How to install ADB commands on Linux
- More useful ADB commands
What are ADB commands
It is a software structure that allows interaction between PCs and Android devices. This architecture can be schematized according to three main parts:
- The client: corresponds to the PC, which can be Windows, Mac, or Linux, which sends commands to the Android device connected via USB cable or wirelessly.
- The daemon: which is the part that physically executes the commands on the connected Android device.
- The server: manages the communication between the two devices. The server is a background process on the Linux PC.
The ADB command protocol needs to be started on the Linux PC to work correctly, this happens by running in the background right at the Linux system level. Once the Android smartphone or tablet is connected to the PC, the ADB service communicates with it by identifying a specific TCP port, determined by Linux at the time of physical connection with the Android device.
What are the ADB commands for
Executing ADB commands on Linux PCs is intended to complete various operations on Android devices. Among the most common, and also the simplest, we find the installation that is usually not available on the Play Store or the enabling of Android options that are generally not available at the stock system level.
In addition to these options, we also find the ability to install updates or entire operating systems via ADB commands on Android devices. The most common operations in this sense correspond, for example, to installing OTA updates on Pixel smartphones or installing factory images.
These last two operations mentioned are of a slightly more complex degree and are recommended in the event that the device cannot be updated through the classic automatic procedures.
Before going to see how to install ADB commands on your Linux PC, it is good to carry out some preliminary operations on your Android device, so that it is ready to receive and execute ADB commands.
The procedure we are about to see is as true for smartphones as it is for Android tablets. These are the same preliminary steps we saw for the guide on Windows and macOS.
- Launch Settings on the Android device.
- Tap Device Information generally at the bottom of the list.
- Then tap on the Build number option 7 times to enable Developer Options.
- Returning to the main Settings screen you should see a new Developer Options menu to access.
- Enable the USB Debugging Mode option within Developer Options.
How to install ADB commands on Linux
- Download the Android SDK Platform Tools for Linux ZIP file.
- Extract the ZIP to an easily accessible location (such as the desktop).
- Open Terminal.
- Enter the following command: cd/path / to / extracted / folder /. (insert correctly the path where the contents of the ZIP file were extracted)
- Connect the Android device to the Linux PC with a compatible USB cable. Change the USB connection mode to ” file transfer (MTP) ” mode. This isn’t always required for all devices, but it’s best to leave it in this mode so you don’t run into any problems.
- Once Terminal is in the same folder where the ADB tools are located, run the following command to start the ADB daemon: sudo ADB devices
- On the Android device, you should see the ” Allow USB Debugging ” prompt. Allow the connection.
- As you can see from the final screenshot below you should see the words ” authorized ” confirming that everything went well in the connection.
More useful ADB commands
Let’s now see which ADB commands are most useful for managing your Android smartphone or tablet.
The following list gathers the command extensions to check the apps installed on the connected device:
- -f for the base APK path for each app, along with the package name
- -a makes sure that all known non-APEX packages are returned
- -d causes the command to return only disabled packages
- -e allows the command to return only enabled packages
- -s to have the command return system packages only
- -3 causes the command to return only third-party packages
- -i includes the installation package name for each package
- -U includes the User ID of each package
- -u includes uninstalled packages
- -show-versioncode includes the version code for each package
- -apex-only returns APEX packages only
- -uid <UID> shows only packets with the specified UID
- -user <USER_ID> displays only packages that belong to the specified user ID
The new list instead shows the commands useful to proceed with the installation of apps on the connected device:
- -r allows ADB to install on an app, but on Android Pie and later, you don’t need to specify this option
- -i allows you to specify the name of an installation package
- -t allows the installation of an APK with android: testOnly = “true” in the manifest
- -d allows you to downgrade the specified APK to an already installed app, but only works if both versions of the app can be debugged
- -g for Android Marshmallow and later versions automatically grants all runtime permissions to the installed app
These commands instead include extensions to disable system apps on the connected device:
- pm disable <package> – To re-enable, pm enable <package>
- pm disable-user –user 0 <package> – To re-enable, pm enable <package>
- pm hide <package> – To re-enable, pm unhide <package>
- pm suspend <package> – To re-enable, pm unsuspend <package>
- pm uninstall -k –user 0 <package> – To re-enable, pm install-existing <package>
Abram left his e-business studies to devote himself to his entrepreneurial projects. In 2017, he created the company Inbound Media and wrote articles about high-tech products for his Chromebookeur site. In 2019, Chromebookeur was renamed Macbound and became a general purchasing advice site. Today, Abram manages the development and growth of Macbound, surrounded by a young and talented team.