ADB (Android Debug Bridge) is a powerful tool that allows you to perform various advanced tasks on your Android device. Using ADB shell commands, you can directly interact with your device's operating system via a command-line interface. Here are some advanced tips for using ADB shell commands:
Setting Up ADB
- Install ADB: Download and install the Android SDK Platform-Tools package, which includes ADB.
- Enable Developer Options: On your Android device, go to Settings > About Phone and tap "Build number" seven times to unlock Developer Options.
- Enable USB Debugging: In Developer Options, enable "USB Debugging".
- Connect Your Device: Use a USB cable to connect your Android device to your computer.
Common ADB Shell Commands
-
Open ADB Shell:
adb shellThis command opens an interactive shell on your device.
-
List Installed Packages:
adb shell pm list packagesLists all the packages installed on your device. You can search for specific packages by name using:
adb shell pm list packages | grep 'part_of_package_name' -
Uninstall an App: If you know the package name of the app, you can uninstall it using:
adb shell pm uninstall -k --user 0 <package_name>The
-kflag keeps the data and cache directories. Omit it if you want everything removed. -
Pull a File from Device:
adb pull /sdcard/myfile.txt /your/local/directoryCopies a file from the device to your computer.
-
Push a File to Device:
adb push /your/local/directory/myfile.txt /sdcard/Copies a file from your computer to the device.
-
Reboot Your Device:
adb rebootThis command will reboot your device. Use
adb reboot recoveryto boot into recovery mode, oradb reboot bootloaderto boot into bootloader/fastboot mode. -
Record Screen:
adb shell screenrecord /sdcard/screenrecord.mp4Records the screen of your device. Press Ctrl+C to stop recording.
-
Capture a Screenshot:
adb shell screencap /sdcard/screenshot.pngTakes a screenshot and saves it to the device.
-
Monitoring Logcat:
adb logcatOutputs the system messages, which can be filtered using grep, level, or tag.
Advanced Commands
-
WLAN Debugging: To connect to your device over Wi-Fi (requires Android 11 or higher typically):
- Connect your device via USB and run:
adb tcpip 5555 - Find your device's IP address:
adb shell ip route - Connect over Wi-Fi:
adb connect <device_ip_address>:5555 - To disconnect:
adb disconnect <device_ip_address>
- Connect your device via USB and run:
-
Modify Settings: Adjust settings directly via ADB:
adb shell settings put system screen_brightness 100Modify the brightness (range is typically 0-255).
-
Automate UI Actions using Input Commands: You can simulate taps, swipes, and key presses:
- Tap:
adb shell input tap x y - Swipe:
adb shell input swipe x1 y1 x2 y2 duration - Key Event:
adb shell input keyevent KEYCODE
- Tap:
These commands are a glimpse into the capabilities offered by ADB. Mastering them will give you deeper control over your Android device for development and troubleshooting purposes. Always ensure you understand the command you're executing, as some commands can alter your device's functioning or system setup.


