Mastering ADB: 61 Essential Commands for Android Debugging and Control

This guide compiles 61 practical ADB commands covering device connection, app management, debugging tools, file transfer, input simulation, device control, and advanced operations, providing Android developers with a comprehensive cheat‑sheet for efficient testing and troubleshooting.

Test Development Learning Exchange
Test Development Learning Exchange
Test Development Learning Exchange
Mastering ADB: 61 Essential Commands for Android Debugging and Control

1. Device Connection and ADB Status

adb connect

– Connect to a device over TCP/IP adb disconnect – Disconnect a device adb devices – List connected devices adb get-serialno – Show device serial number adb get-state – Show current device state adb tcpip – Enable/disable wireless debugging

2. Application Management

adb install <apk_path>

– Install an app adb uninstall <package_name> – Uninstall an app adb shell am start -n <package/activity> – Launch an app adb shell am force-stop <package> – Force‑stop an app adb shell pm clear <package> – Clear app data adb shell dumpsys package – Show detailed app info adb shell pm list packages – List all installed packages adb shell – Open a remote shell adb shell pm list packages -f – List packages with their APK paths

3. Debugging Tools and Information

adb shell dumpsys activity | grep -i run

– List running apps adb shell getprop ro.build.version.release – Show Android version adb logcat | grep -i <keyword> – Filter recent logs adb shell getprop ro.product.cpu.abi – Show CPU architecture adb shell df – Display storage usage adb shell dumpsys activity activities | grep -i run – Show current foreground activity adb shell dumpsys meminfo – Show memory usage adb shell top -m 10 -d 15 -n 1 – Show top CPU‑consuming processes adb shell df /data – Show internal storage space adb shell dumpsys battery – Show battery status adb shell wm size – Show screen resolution adb shell wm density – Show screen DPI adb shell cat /proc/meminfo – Show virtual memory info adb shell cat /proc/cpuinfo – Show CPU details adb shell dumpsys meminfo -d – Detailed memory state of processes adb shell dumpsys cpuinfo – Performance testing adb shell dumpsys activity > dump_file.txt – Save system dump to file

4. File Operations

adb shell screencap -p /sdcard/screen.png

– Capture remote screenshot adb pull /sdcard/file_name.txt – Download file from device adb push file_name.txt /sdcard/ – Upload file to device adb shell cat /sys/class/net/wlan0/address – Show MAC address adb shell ifconfig | grep "inet addr" – Show IP address adb push – Copy files or directories to device adb pull – Copy files or directories from device

5. Input/Output Operations

adb shell input text "example"

– Simulate text input adb shell input keyevent <keycode> – Simulate key press

6. Device Control

adb reboot

– Reboot device adb reboot bootloader – Reboot into Fastboot mode adb reboot recovery – Reboot into Recovery mode

7. Other Operations

adb shell pm list permissions -g

– List permission groups adb -s emulator-5556 emu kill / adb shell am start -n <...> – Manage AVD

adb shell ls -lR | awk 'BEGIN { FS="[ \t]+"; }; /^-/ { name=substr($0, index($0,$9)); }; /^-/ && fsize[name]==$5 { printf("%s is a duplicate of %s
", $9, name); }; /^-/ { fsize[name]=$5; }'

– Find duplicate files

adb shell ls -lR | grep -v '^d' | awk '{size=$5; name=$NF; sub(/^.*\//, "", name); if (fsize[size] && fsize[size]==name) printf("%s is a duplicate of %s
", name, fsize[size]); else fsize[size]=name;}'

– Show duplicate file details adb shell ps | grep <process> – Find app PID adb shell ps -A | grep <process> – Search for processes adb shell pm list packages -s – List system packages adb shell dumpsys package – Show required permissions adb shell dumpsys package | grep userId= – Show user UID

adb shell am start -n com.android.settings/.wifi.WifiApDialog

– Set Wi‑Fi hotspot SSID

adb shell am start -n com.android.settings/.Settings\$DataUsageSummaryActivity

– Toggle mobile data adb backup -f FILE_NAME -noapk PACKAGE_NAME – Backup specific app adb restore FILE_NAME.ab – Restore app backup adb shell getevent -S – Show input device info

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

DebuggingMobile DevelopmentAndroidcommand-lineADBdevice management
Test Development Learning Exchange
Written by

Test Development Learning Exchange

Test Development Learning Exchange

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.