Android Debug Bridge (ADB) is a versatile command-line tool that lets you customize, debug, hack, tweak, or query your Android smart phone, or tablet, or any other Android device for that matter. Have you ever wanted to unintsall all that bloatware that the UI does not let you uninstall? Well, you can with ADB. Do you want to figure out what apps are eating up your battery - and then fix them so they don't anymore? You can with ADB. ADB is essentially a linux terminal into your phone so whether you're a developer debugging apps, a power user customizing your device, or a tech enthusiast exploring Android's capabilities, ADB is worth learning.
C:\adb
C:\adb
# Using Homebrew
brew install android-platform-tools
# Or download directly and add to PATH
echo 'export PATH=$PATH:~/adb-tools' >> ~/.zshrc
# Ubuntu/Debian
sudo apt-get install android-tools-adb
# Fedora
sudo dnf install android-tools
# Arch
sudo pacman -S android-tools
In order to use ADB, you must enable Developer Options on your Android device (phone, tablet, etc). Here is how:
Enable Developer Options
Enable USB Debugging
Authorize Your Computer
You are now ready to try out some adb commands and see what you can learn about your phone. ADB has a ton of command (phenominal cosmic power in a ity bity linux space). We will go through some of the most useful ones here and perhaps a few of the more nerdy ones too. Now go to that DOS/Linux prompt and let's get started.
# Battery (basic info only)
adb shell dumpsys battery | grep -E "(level|health|status|technology)"
level: 85 = Battery charge percentage (85%)
health: 2 = Battery condition (1=Unknown, 2=Good, 3=Overheat, 4=Dead, 5=Over voltage, 6=Unspecified failure, 7=Cold)
status: 2 = Charging state (1=Unknown, 2=Charging, 3=Discharging, 4=Not charging, 5=Full)
technology: Li-ion = Battery chemistry type
# CPU info (limited)
adb shell getprop ro.product.cpu.abi
arm64-v8a = CPU architecture (arm64-v8a, armeabi-v7a, x86, x86_64)
adb shell nproc
8 = Number of CPU cores
# Memory (app-accessible only)
adb shell dumpsys meminfo | head -20
# Storage (accessible partitions)
adb shell df /data /system /sdcard
filesystem
1K-blocks = Total space in KB
Used = Used space in KB
Available = Free space in KB
Use% = Percentage used
# Network (basic connectivity)
adb shell dumpsys connectivity | grep -E "(NetworkInfo|State)"
# Screen resolution and density
adb shell wm size
Physical size: 1080x2400 = Screen resolution in pixels (width x height)
adb shell wm density
Physical density: 420 = DPI (dots per inch) - higher = sharper display
# Display info
adb shell dumpsys display | grep -E "(Display|Resolution|Density)"
# Camera features from package manager
adb shell pm list features | grep -i camera
android.hardware.camera = Basic camera support
android.hardware.camera.autofocus = Auto-focus capability
android.hardware.camera.flash = Flash available
android.hardware.camera.front = Front-facing camera
android.hardware.camera.any = Any camera available
# Camera hardware info
adb shell getprop | grep -i camera
# Device properties (always accessible)
adb shell getprop ro.product.model
adb shell getprop ro.product.manufacturer
adb shell getprop ro.product.brand
adb shell getprop ro.build.version.release
13 = Android version number
adb shell getprop ro.build.version.sdk
33 = Android API level (correlates to Android version)
adb shell getprop ro.boot.hardware.sku
G020G = Hardware SKU (often the actual model number)
# Hardware features
adb shell pm list features | grep -E "(hardware|sensor)"
# OS version and security
adb shell getprop ro.build.version.security_patch
2024-01-05 = Last security patch date (YYYY-MM-DD format)
adb shell getprop ro.build.version.release
adb shell pm list features | grep -E "(fingerprint|face)"
android.hardware.fingerprint = Fingerprint sensor available
android.hardware.biometrics.face = Face unlock supported
# Audio features
adb shell pm list features | grep -i audio
android.hardware.audio.output = Audio output capability
android.hardware.audio.low_latency = Low-latency audio support
android.hardware.audio.pro = Professional audio features
# Installed audio/video packages (shows capabilities)
adb shell pm list packages | grep -E "(camera|music|phone)"
# Network features
adb shell pm list features | grep -E "(wifi|bluetooth|nfc|telephony)"
android.hardware.wifi = WiFi capability
android.hardware.wifi.direct = WiFi Direct support
android.hardware.bluetooth = Bluetooth available
android.hardware.bluetooth_le = Bluetooth Low Energy support
android.hardware.nfc = NFC chip present
android.hardware.telephony = Cellular capability
android.hardware.telephony.gsm = GSM network support
# Network state
adb shell dumpsys wifi | grep -E "(state|enabled)"
# Comprehensive device info
adb shell getprop | grep -E "(ro.product|ro.build|ro.hardware)"
# All supported features
adb shell pm list features
# Installed apps
adb shell pm list packages -f
You likely noticed a few commands that were used over and over in this list of commands, namely shell, dumpsys, getprop, list, wm, and pm. Let's take a minute to explain each of these.
adb shell opens a command prompt directly on your Android device, like opening a terminal window on your phone. When you type adb shell, you're essentially logging into your phone's operating system and can run commands as if you were sitting at the phone's command line.
adb getprop stands for Get System Properties. It reads system properties (configuration settings) stored by Android
adb shell getprop ro.build.version.security_patch
adb shell getprop ro.build.version.release
pm is Package Manager. The PM manages and queries installed apps and hardware features.
adb shell pm list packages
adb shell pm list features
wm is Window Manager. It controls display settings like screen resolution and density.
adb shell wm size
adb shell wm density
dumpsys is Dump System Services. It dumps detailed information from Android's system services. Think of it as getting a detailed "status report" from different parts of your phone. For example: Battery level, charging status, WiFi connection details
OK, now that you have the basics here are a few tricks I have found very useful.
adb shell find /system -name "*sqlite*" 2>/dev/null
The system cannot find the path specified.
adb shell "find /system -name \"*sqlite*\" 2>/dev/null"
/system/lib64/libsqlite.so
/system/lib/libsqlite.so
#first git the Uids (integer version) of the programs that are draining your battery
adb shell "dumpsys batterystats --charged | grep 'Uid u0a' | head -10 | sed 's/.*Uid u0a\([0-9]*\).*/10\1/'"
10119
10267
#Next, for each Uid returned get the package names
adb shell "pm list packages --uid 10119"
package:com.google.android.youtube uid:10119
adb shell "pm list packages --uid 10267"
package:com.google.android.apps.tachyon uid:10267
#Lastly, for each package name set it to not run in background
adb shell cmd appops set com.google.android.youtube RUN_IN_BACKGROUND ignore
adb shell cmd appops set com.google.android.apps.tachyon RUN_IN_BACKGROUND ignore
adb shell dumpsys batterystats --reset
Finally, let me share a few more advanced commands. Remember I told you that ADB was really powerful, right. Well these commands prove it.
List connected devices:
adb devices
Restart ADB server (fixes many connection issues):
adb kill-server
adb start-server
adb devices
Find your device's IP address:
# Method 1: Via ADB
adb shell ip addr show wlan0
adb shell ifconfig wlan0
# Method 2: Via settings
adb shell settings get global wifi_on
# Or check manually: Settings → About → Status → IP address
# Method 3: From device info
adb shell getprop | grep ip
Reboot device:
adb reboot
adb reboot recovery
adb reboot bootloader
Install an app (apk):
adb install app.apk
adb install -r app.apk # Reinstall keeping data
adb install -g app.apk # Grant all permissions
Uninstall an app:
adb uninstall com.example.app
adb uninstall -k com.example.app # Keep data
List installed packages:
adb shell pm list packages
adb shell pm list packages -f # Show APK files
adb shell pm list packages -3 # Third-party only
Clear app data:
adb shell pm clear com.example.app
Push files to device:
adb push localfile.txt /sdcard/
adb push folder/ /sdcard/folder/
Pull files from device:
adb pull /sdcard/file.txt
adb pull /sdcard/DCIM/ photos/
Browse device filesystem:
adb shell ls /sdcard/
adb shell ls -la /data/data/ # Requires root
Get device properties:
adb shell getprop
adb shell getprop ro.build.version.release # Android version
adb shell getprop ro.product.model # Device model
View running processes:
adb shell ps
adb shell top
Check memory usage:
adb shell dumpsys meminfo
adb shell dumpsys meminfo com.example.app
Take a screenshot:
adb shell screencap /sdcard/screenshot.png
adb pull /sdcard/screenshot.png
Record screen:
adb shell screenrecord /sdcard/video.mp4
# Press Ctrl+C to stop recording
adb pull /sdcard/video.mp4
Simulate input:
adb shell input tap 500 1000 # Tap at coordinates
adb shell input swipe 100 500 100 1000 # Swipe
adb shell input text "Hello" # Type text
adb shell input keyevent 3 # Home button
Access device shell:
adb shell
# Now you're in the device's Linux shell
Run commands as root (if available):
adb root
adb shell su -c "command"
Change system settings:
# Show all settings
adb shell settings list system
adb shell settings list global
adb shell settings list secure
# Modify settings
adb shell settings put global airplane_mode_on 1
adb shell settings put system screen_brightness 200
Backup an app with data:
adb backup -apk -shared -nosystem com.example.app
Restore from backup:
adb restore backup.ab
View app logs:
adb logcat
adb logcat -s ActivityManager # Filter by tag
adb logcat *:E # Errors only
Monitor app crashes:
adb logcat -b crash
CPU usage:
adb shell dumpsys cpuinfo
Battery stats:
adb shell dumpsys battery
adb shell dumpsys batterystats
Network statistics:
adb shell dumpsys netstats
Launch app:
adb shell am start -n com.example.app/.MainActivity
ADB is a powerful tool that opens up endless possibilities for Android customization and development. From simple tasks like installing apps to complex debugging and automation, mastering ADB gives you unprecedented control over your Android devices.
Start with basic commands and gradually explore more advanced features. Remember to always be cautious when modifying system settings or running commands with elevated privileges. With practice, ADB will become an invaluable part of your Android toolkit.