Android ADB Power Tips: Control and Debug Your Phone from the Terminal

Android ADB Power Tips: Control and Debug Your Phone from the Terminal


ADB (Android Debug Bridge) is a command-line tool that lets you communicate with your Android device from a computer. It’s included in the Android SDK Platform Tools and works on Windows, macOS, and Linux. With ADB, you can install apps, remove bloatware, capture screenshots, transfer files, debug apps, and do things that aren’t possible through the regular Settings app.

Installing ADB

macOS

brew install android-platform-tools

Ubuntu / Debian

sudo apt install android-tools-adb

Windows

Download Platform Tools from developer.android.com/tools/releases/platform-tools and add to PATH.

Or use winget:

winget install Google.PlatformTools

Verify installation:

adb version

Enable USB Debugging on Your Phone

  1. Go to SettingsAbout phone
  2. Tap Build number 7 times to enable Developer options
  3. Go back to SettingsDeveloper options
  4. Enable USB debugging
  5. Connect your phone via USB cable
  6. Accept the RSA key fingerprint prompt on your phone

Verify connection:

adb devices

You should see your device listed as device (not unauthorized or offline).

Wireless ADB (No Cable Needed)

Android 11+

# Enable wireless debugging on phone:
# Settings → Developer options → Wireless debugging → Enable
# Tap "Pair device with pairing code" to get IP and pairing code

adb pair 192.168.1.50:37099   # Enter the pairing code when prompted
adb connect 192.168.1.50:41567  # Use the port shown under "Wireless debugging"

Older Android versions

First connect via USB, then:

adb tcpip 5555
adb connect 192.168.1.50:5555
# Now you can unplug the USB cable

To switch back to USB mode:

adb usb

Essential ADB Commands

Device Information

# List connected devices
adb devices -l

# Get device model
adb shell getprop ro.product.model

# Android version
adb shell getprop ro.build.version.release

# Get serial number
adb get-serialno

# Battery status
adb shell dumpsys battery

# Screen resolution
adb shell wm size

# IP address
adb shell ip addr show wlan0

Installing and Managing Apps

# Install an APK
adb install app.apk

# Install and replace existing
adb install -r app.apk

# Install to SD card
adb install -s app.apk

# Uninstall an app
adb uninstall com.example.app

# Uninstall but keep data
adb uninstall -k com.example.app

# List all installed packages
adb shell pm list packages

# List third-party (user-installed) apps
adb shell pm list packages -3

# List system apps
adb shell pm list packages -s

# Find a specific package
adb shell pm list packages | grep spotify

# Get APK path for an app
adb shell pm path com.example.app

# Pull an APK from device
adb pull $(adb shell pm path com.example.app | sed 's/package://') ./app.apk

Remove Bloatware (Without Root)

You can disable pre-installed apps you can’t normally uninstall:

# Disable an app (removes from launcher, frees RAM)
adb shell pm disable-user --user 0 com.samsung.android.game.gamehome

# Uninstall for current user (keeps system files intact)
adb shell pm uninstall -k --user 0 com.facebook.appmanager

# Re-enable a disabled app
adb shell pm enable com.samsung.android.game.gamehome

# Reinstall a removed app
adb shell cmd package install-existing com.facebook.appmanager

Common bloatware package names:

AppPackage Name
Facebookcom.facebook.katana
Facebook Servicescom.facebook.appmanager
Samsung Game Launchercom.samsung.android.game.gamehome
Samsung Bixbycom.samsung.android.bixby.agent
Samsung Browsercom.sec.android.app.sbrowser
Google Newscom.google.android.apps.magazines
OneDrivecom.microsoft.skydrive

Warning: Don’t disable system-critical apps like Settings, Phone, or System UI. Research each package before removing.

File Transfers

# Copy file from computer to phone
adb push local-file.txt /sdcard/Download/

# Copy file from phone to computer
adb pull /sdcard/DCIM/Camera/photo.jpg ./

# Copy entire folder
adb pull /sdcard/DCIM/ ./phone-photos/

# Push multiple files
adb push *.mp3 /sdcard/Music/

Screenshots and Screen Recording

# Take a screenshot
adb shell screencap /sdcard/screenshot.png
adb pull /sdcard/screenshot.png ./

# One-liner: screenshot to computer
adb exec-out screencap -p > screenshot.png

# Record screen (stop with Ctrl+C)
adb shell screenrecord /sdcard/recording.mp4

# Record with time limit (max 180 seconds)
adb shell screenrecord --time-limit 30 /sdcard/recording.mp4

# Record with specific resolution
adb shell screenrecord --size 720x1280 /sdcard/recording.mp4

# Pull the recording
adb pull /sdcard/recording.mp4 ./

Screen Mirroring with scrcpy

scrcpy is a free tool that mirrors your Android screen on your computer with low latency:

# Install
brew install scrcpy           # macOS
sudo apt install scrcpy       # Ubuntu
# Windows: download from GitHub releases

# Mirror screen
scrcpy

# Mirror wirelessly
scrcpy --tcpip=192.168.1.50

# Mirror with specific resolution
scrcpy --max-size 1024

# Record while mirroring
scrcpy --record screen.mp4

# Mirror with window title
scrcpy --window-title "My Phone"

Logcat (App Debugging)

# View all logs (very verbose)
adb logcat

# Filter by priority (V=Verbose, D=Debug, I=Info, W=Warn, E=Error)
adb logcat *:E              # Errors only

# Filter by tag
adb logcat -s MyApp         # Only logs tagged "MyApp"

# Filter by package name
adb logcat --pid=$(adb shell pidof com.example.app)

# Clear log buffer
adb logcat -c

# Save logs to file
adb logcat -d > logcat.txt

# Show timestamps
adb logcat -v time

System Controls

# Reboot device
adb reboot

# Reboot to recovery
adb reboot recovery

# Reboot to bootloader
adb reboot bootloader

# Shutdown
adb shell reboot -p

# Simulate key press
adb shell input keyevent KEYCODE_HOME         # Home button
adb shell input keyevent KEYCODE_BACK         # Back button
adb shell input keyevent KEYCODE_POWER        # Power button
adb shell input keyevent KEYCODE_VOLUME_UP    # Volume up

# Type text
adb shell input text "Hello"

# Tap at coordinates
adb shell input tap 500 800

# Swipe
adb shell input swipe 500 1500 500 500        # Swipe up

# Open a URL
adb shell am start -a android.intent.action.VIEW -d "https://example.com"

# Open Settings
adb shell am start -n com.android.settings/.Settings

# Take a bug report
adb bugreport > bugreport.zip

Change Device Settings

# Change screen density (DPI)
adb shell wm density 400

# Reset density to default
adb shell wm density reset

# Change resolution
adb shell wm size 1080x1920

# Reset resolution
adb shell wm size reset

# Stay awake while charging
adb shell settings put global stay_on_while_plugged_in 3

# Disable animations (speeds up device)
adb shell settings put global window_animation_scale 0.0
adb shell settings put global transition_animation_scale 0.0
adb shell settings put global animator_duration_scale 0.0

# Re-enable animations
adb shell settings put global window_animation_scale 1.0
adb shell settings put global transition_animation_scale 1.0
adb shell settings put global animator_duration_scale 1.0

Backup and Restore

# Full backup (will prompt on device)
adb backup -apk -shared -all -f backup.ab

# Backup specific app
adb backup -apk com.example.app -f app-backup.ab

# Restore backup
adb restore backup.ab

Useful One-Liners

# Get battery percentage
adb shell dumpsys battery | grep level

# List running activities
adb shell dumpsys activity activities | grep mResumedActivity

# Get Wi-Fi password (requires root)
adb shell cat /data/misc/wifi/WifiConfigStore.xml

# Generate a bug report
adb bugreport

# Open app from command line
adb shell monkey -p com.spotify.music -c android.intent.category.LAUNCHER 1

Troubleshooting

”device unauthorized”

Accept the RSA key prompt on your phone. If it doesn’t appear, revoke USB debugging authorizations in Developer options and reconnect.

”no devices/emulators found”

  • Check USB cable (use data cable, not charge-only)
  • Try a different USB port
  • Install device drivers (Windows)
  • Restart ADB: adb kill-server && adb start-server

”device offline”

adb kill-server
adb start-server
adb devices

Conclusion

ADB unlocks a level of control over your Android device that no Settings menu can match. From removing bloatware without root to wireless screen mirroring, file transfers, and detailed debugging — it’s an essential tool for Android power users and developers. Keep the Platform Tools installed and a cable nearby, and you’ll have a Swiss Army knife for any Android situation.