ADB is something that many Android enthusiasts use, but its full potential is often overlooked. ADB stands for “Android Debug Bridge,” and it is a command line tool that is used to communicate with a smartphone, tablet, smartwatch, set-top box, or any other device that can run the Android operating system (even an emulator). Specific commands are built into the ADB binary and while some of them work on their own, most are commands we send to the connected device.
ADB allows you to do things on an Android device that may not be suitable for everyday use, yet can greatly benefit your user or developer experience. For example, you can install apps outside of the Play Store, debug apps, access hidden features, and bring up a Unix shell so you can issue commands directly on the device. So for security reasons, Developer Options need to be unlocked and you need to have USB Debugging Mode enabled as well. Not only that, but you also need to authorize USB Debugging access to the specific PC that you’re connected to with a USB cable.
What is ADB?
Since ADB is a client-server program, there are three components that make up the entire process. First, we have what Google calls the Client, the computer you have connected to your Android device. It’s from this computer that we are sending commands to our device through the USB cable (and wirelessly as well in some cases). Next up is the daemon (also known as adbd), and this is a service that is currently running on both the computer as well as the Android device and allows the latter to accept and execute commands.
The last of the three components of ADB is called the Server and this is a piece of software that actually manages the communication between the client and the daemon. So after you type in an ADB command in a command prompt, PowerShell, or a terminal, it’s the server that is running as a background process on your computer that sends this command to the daemon. All three components work together to give you this type of access to your smartphone, tablet, smartwatch, and more.
How Does ADB Work?
Because there are three pieces that makeup ADB (the Client, Daemon, and the Server), this requires certain pieces to be up and running in the first place. So if you have freshly booted the computer (and you don’t have it setup to start the daemon on boot), then you will need it to be running before any communication can be sent to the Android device. You’ll see this the following message in the command prompt or terminal, as it will check to make sure the daemon is running.
If the daemon isn’t running, then it will start the process and tell you which local TCP port it has been started on. Once that ADB service has been started, it will continue to listen to that specific port for commands that have been sent by the ADB client. It will then set up connections to all running devices which are attached to the computer (including emulators). This is the moment where you’ll receive the authorization request on the Android device if the computer hasn’t been authorized in the past.
Examples of ADB
As mentioned above, you can use ADB to do all sorts of things on an Android device. Some of these commands are built directly into the ADB binary and should work on all devices. You can also open up what is referred to as an ADB Shell and this will let you run commands directly on the device. The commands which are run directly on the device can vary from device to device (since OEMs can remove access to certain ones, and also modify adb behavior) and can vary from one version of Android to the next as well.
Below, you’ll find a list of example commands which you can do on your device…
- Print a list of connected devices:
adb devices
- Kill the ADB server:
adb kill-server
- Install an application:
adb install
- Set up port forwarding:
adb forward tcp:6100 tcp:7100
- Copy a file/directory from the device:
adb pull
- Copy a file/directory to the device:
adb push
- Initiate an ADB shell:
adb shell
How do I install ADB?
Phone Setup
- Launch the Settings application on your phone.
- Tap the About Phone option generally near the bottom of the list.
- Then tap the Build Number option 7 times to enable Developer Mode. You will see a toast message when it is done.
- Now go back to the main Settings screen and you should see a new Developer Options menu you can access.
- Go in there and enable the USB Debugging option.
- You are partially done with the phone setup process. Next up, you will need to scroll below and follow the rest of the instructions for your particular operating system.
Microsoft Windows ADB Setup
- Download the Platform Tools ZIP file for Windows
- Extract the contents of this ZIP file into an easily accessible folder (such as C:\adb)
- Open Windows Explorer and browse to where you extracted the contents of this ZIP file
- Then open up a Command Prompt from the same directory as this ADB binary. This can be done by holding Shift and Right-clicking within the folder then click the “Open Command Prompt here” option. (Some Windows 10 users may see “PowerShell” instead of “Command Prompt”.)
- Connect your smartphone or tablet to your computer with a USB cable. Change the USB mode to “file transfer (MTP)” mode. Some OEMs may or may not require this, but it’s best to just leave it in this mode for general compatibility.
- In the Command Prompt window, enter the following command to launch the ADB daemon:
adb devices
- On your phone’s screen, you should see a prompt to allow or deny USB Debugging access. Naturally, you will want to grant USB Debugging access when prompted (and tap the always allow check box if you never want to see that prompt again).
- Finally, re-enter the command from step #6. If everything was successful, you should now see your device’s serial number in the command prompt. Yay! You can now run any ADB command on your device! Now go forth and start modding your phone by following our extensive list of tutorials!
How to Install ADB on macOS
- Download the Platform Tools ZIP file for macOS
- Extract the ZIP to an easily accessible location (like the Desktop for example).
- Open Terminal.
- To browse to the folder you extracted ADB into, enter the following command:
cd /path/to/extracted/folder/
- For example, on my Mac it was this:
cd /Users/Doug/Desktop/platform-tools/
- Connect your device to your Mac with a compatible USB cable. Change the USB connection mode to “file transfer (MTP)” mode. This is not always required for every device, but it’s best to just leave it in this mode so you don’t run into any issues.
- Once the Terminal is in the same folder your ADB tools are in, you can execute the following command to launch the ADB daemon:
adb devices
- On your device, you’ll see an “Allow USB debugging” prompt. Allow the connection.
- Finally, re-enter the command from step #7. If everything was successful, you should now see your device’s serial number in macOS’s Terminal window. Congratulations! You can now run any ADB command on your device! Now go forth and start modding your phone by following our extensive list of tutorials!
How to Install ADB on Linux
- Download the Platform Tools ZIP file for Linux
- Extract the ZIP to an easily accessible location (like the Desktop for example).
- Open a Terminal window.
- Enter the following command:
cd /path/to/extracted/folder/
- This will change the directory to where you extracted the ADB files.
- So for example:
cd /Users/Doug/Desktop/platform-tools/
- Connect your device to your Linux machine with your USB cable. Change the connection mode to “file transfer (MTP)” mode. This is not always necessary for every device, but it’s recommended so you don’t run into any issues.
- Once the Terminal is in the same folder your ADB tools are in, you can execute the following command to launch the ADB daemon:
adb devices
- Back on your smartphone or tablet device, you’ll see a prompt asking you to allow USB debugging. Go ahead and grant it.
- Finally, re-enter the command from step #8. If everything was successful, you should now see your device’s serial number in the Terminal window output. Congrats! You can now run any ADB command on your device! Now go forth and start modding your phone by following our extensive list of tutorials!
Some Linux users should be aware that there can be an easier way to install ADB on their computer. The guide above will certainly work for you, but those own a Debian or Fedora/SUSE-based distro of Linux can skip steps 1 and 2 of the guide above and use one of the following commands:
- Debian-based Linux users can type the following command to install ADB:
sudo apt-get install adb
- Fedora/SUSE-based Linux users can type the following command to install ADB:
sudo yum install android-tools
However, it is always better to opt for the latest binary from the Android SDK Platform Tools release, since the distro-specific packages often contain outdated builds.
Recommended reading: How to Use ADB or Fastboot From Any Directory on your Windows/Linux PC, How to quickly setup and use ADB
What else can I do with ADB?
Below is a list of XDA tutorials for various devices that detail many applications of ADB commands in order to modify hidden settings, customize OEM features or user interfaces, and much more!
- How to Uninstall Carrier/OEM Bloatware Without Root Access
- How to Increase the Edge Screen Size on Samsung Galaxy Phones Without Root
- How to Manually Change the Samsung Galaxy S8, S8+, or Note 8 Navigation Bar Color
- How to Force Apps to Fill the Screen on the Essential Phone
- How to get “Turn on WiFi Automatically” for the Nexus 5X/6P on Android Oreo
- How to Stop Wakelocks from Any Android App Without Root
- How to Whitelist Apps from Android Oreo’s Background Location Throttling
- How to Hide the “App is Running in the Background” Persistent Notification on Android Oreo
- How to Check if Your Android 8.0 Oreo Device Supports Project Treble
- Broken Navigation Bar, Lock Screen, or Status Bar after an Update? Here’s a Fix.
- How to Sync Do Not Disturb Mode Between Android Wear and Your Phone
- How to see the Boot Count of your Android 7.0+ Device
- How to Change the SMS Limit on Android Without Root
- How to Set a WiFi Network as Metered on Huawei or Honor Devices
- How to Downgrade an App on Android – No Root Needed
- How to Customize Battery Saver Mode in Android 8.0 Oreo
- How to Customize the Navigation Bar in Android Oreo Without Root
- How to Access Facebook Messenger’s Hidden Internal Menu
- How to Customize which Radios are Disabled in Airplane Mode
- How to Pair Android Wear Watches to New Phones without Factory Resetting
- How to Stop Pokemon Go (or other apps) From Stealing Audio Focus
- How to Stop Vibrations from Any Android App on Your Phone
- How to Block Heads Up Notifications while Gaming or Watching a Video
- How to Hide the Persistent Notification for Background Apps in Android O
- How to Permanently Remove the Google Chromecast Notification
- How to Freeze Any App’s Background Processes without Root on Android 7.0+
- How to set a Custom Screen Saver on Huawei and Honor devices running EMUI
- How to Add more Tiles to the Quick Settings Header on Google, OnePlus, and Sony Phones [No Root]
- How to Add Custom Buttons to the Nav Bar on the Samsung Galaxy S8/S8+
- How to Add Left/Right Keyboard Cursors to the Nav Bar during Text Input
- How to Add Media Playback Controls to the Nav Bar when Playing Music
- Three Actually-Hidden, Non-Clickbaity Tricks for Your New Galaxy S8 or S8+
- How to change your Nav Bar Icons or Re-arrange the Buttons without Root