11 Common ADB Commands You Should Know
The Android Debug Bridge (ADB) is a powerful command-line tool that allows you to interact with your Android device from your computer, enabling a wide range of tasks that would otherwise be difficult or impossible. Here are 11 common ADB commands that every Android user should know.
Setting Up ADB
Before you can use ADB commands, you need to set up ADB on your computer and enable Developer Options and USB debugging on your Android device.
-
Enable Developer Options:
- Open “Settings.”
- Tap “System.” On older Android devices, look for “About phone.”
- Tap “About phone.”
- Tap “Software information.” On older Android devices, look for “Build number” and skip to the next step.
- Tap “Build number” at least seven times until you see a message saying “You’re now a developer” at the bottom of your screen.
-
Enable USB Debugging:
- Open “Settings.”
- Tap “System.”
- Tap “Developer options.”
- Toggle “USB debugging” to On.
- Confirm you want to enable it.
1. Show Connected Devices
To ensure that ADB is ready to communicate with your Android device, you need to list the connected devices.
adb devices
This command will display the serial number of your connected devices in the command prompt or Terminal.
2. Reboot Your Device
This command reboots your device in normal mode, which is useful after flashing something to your device or if your device becomes unresponsive.
adb reboot
3. Reboot into Recovery
Rebooting into recovery mode can be helpful for performing system updates or wiping the cache.
adb reboot recovery
4. Reboot into Bootloader
Rebooting into bootloader mode is necessary for flashing custom ROMs or unlocking the bootloader.
adb reboot bootloader
5. Reboot into Fastboot
Fastboot mode is used for flashing firmware, bootloaders, or recovery images.
adb reboot fastboot
6. Send File to Your Device
You can transfer files from your computer to your Android device using the push
command.
adb push example.apk /mnt/sdcard/Download/
This command copies the example.apk
file from your computer to the Download folder on your device.
7. Get Files from Your Device
To copy files from your Android device to your computer, use the pull
command.
adb pull /mnt/sdcard/Download/example.apk
This command copies the example.apk
file from the Download folder on your device to your computer.
8. Install an App on Your Device
You can install an APK file on your device using ADB.
adb install example.apk
Alternatively, if the APK is already on your device, you can install it from there.
adb shell pm install /mnt/sdcard/Download/example.apk
9. Remount the System
Remounting the system partition as read-write can be useful for making system-level changes.
adb remount
10. Sideload System Updates
You can sideload system updates using ADB, which is particularly useful if you cannot update through the normal update process.
adb sideload update.zip
11. Create and Restore a Backup
Creating a backup of your device or restoring from a backup can be done using ADB.
adb backup -all -f backup.ab
To restore from a backup:
adb restore backup.ab
These commands help you manage your device's data effectively.
Additional Tips
-
Start and Kill ADB Server:
- To start the ADB server:
adb start-server
- To kill the ADB server:
adb kill-server
.
- To start the ADB server:
-
Connect to Device Wirelessly:
- Set the target device to listen for a TCP/IP connection:
adb tcpip 5555
- Connect to the device using its IP address:
adb connect 192.xxx.xxx.xx:5555
.
- Set the target device to listen for a TCP/IP connection:
-
Logcat:
-
View device logs:
adb logcat
-
Clear logs:
adb logcat -c
-
Save logs to a file:
adb logcat -d > log.txt
.
Understanding and using these ADB commands can significantly enhance your ability to manage and troubleshoot your Android device.