----------------------------------------------------------------------------------------------------------------------
ADB Commands:
----------------------------------------------------------------------------------------------------------------------
adb help
Shows ADB Help Documentation.
adb devices
Lists all the Android Devices connected via ADB.
adb reboot
Reboots your Android Device.
adb reboot bootloader
Reboots your Android Device into Fastboot / Bootloader Mode.
adb reboot recovery
Reboots your Android device into Recovery Mode.
adb install
Helps you install an APK File on your Android Device.
adb install filename.apk
Install the APK File.
adb install -r filename.apk
Re-installs or updates an App.
adb install -s filename.apk
Installs the APK File in SD Card (if the App supports).
adb uninstall
Helps you install an App File on your Android Device.
adb uninstall com.facebook.katana
Simply uninstalls the App.
adb uninstall -k com.facebook.katana
Keeps the Data and Cache Folder after the App is uninstalled.
adb logcat
Displays the Log Data onto the Screen.
adb bugreport
Displays the Dumpsys, Dumpstate and Logcat Data on the Screen.
adb jdwp
Lists the JDWP (Java Debug Wire Protocol) Processes on the Device.
adb get-serialno
Shows the adb instance Serial Number String with the Device.
adb get-state
Displays the Device Status.
adb wait-for-device
Used to set a delay before the next Command is issued.
It executes when the Device is online but it can be programmed to wait till another Process is done.
adb start-server
Starts the ADB Server Process.
adb kill-server
Stops the ADB Server Process.
adb sideload <filename.zip>
Used to flash a Zip File in Recovery Mode when the Zip File is available in the Computer.
adb pull </path/filename>
Pulls any File from your Device and saves it on your Computer.
adb push <source-path> <target-path>
Used to push a File into your Android Device.
----------------------------------------------------------------------------------------------------------------------
ADB Shell Commands:
----------------------------------------------------------------------------------------------------------------------
adb shell
Starts the Remote Shell Command Console in the Device.
adb shell pm uninstall -k –user 0 package.name.com
Helps you uninstall a System App from your Android Device.
Replace package.name.com with the actual Package Name.
adb shell dumpsys
Dumps all System Data about your Android Device’s Dardware and Software Configuration
adb shell dumpsys display
Displays all the Hardware and Software Configuration about your Display.
adb shell dumpsys battery
Displays all the Hardware and Software Configuration about your Battery.
adb shell dumpsys batterystats
Displays all the Info about your Battery Statistics.
adb shell wm density
Helps you change the Pixel Density on your Android Device.
adb shell pm list packages
Lists all the Apps installed on your Device as Package Names.
adb shell pm list packages -s
Lists all the System Apps installed on your Device as Package Names.
adb shell pm list packages -3
Lists all the 3rd Party Apps installed on your Device as Package Names.
adb shell pm list packages -d
Lists all the disabled Apps on your Device as Package Names.
adb shell pm list packages -e
Lists all the enabled Apps on your Device as Package Names.
adb shell pm list packages -u
Lists all the uninstalled Apps with installed Pages on your Device as Package Names.
adb shell screencap /sdcard/screenshot.png
Takes a Screenshot of your Device Screen and saves it in SDCARD with the name "screenshot.png".
adb shell screenrecord /sdcard/screenrecord.mp4
Starts recording your Device Screen and saves the Video in SDCARD with the name "screenrecord.mp4".
The default Record Time is 180 Seconds (Maximum). You can press CTRL + C to stop the recording any Time.
adb shell screenrecord –size 1920×1080 /sdcard/screenrecord.mp4
Screen recording with custom Width and Height for the Video.
adb shell screenrecord –time-limit 120 /sdcard/screenrecord.mp4
Screen recording with custom Time Limit for the Video.
Max value is 180.
adb shell screenrecord –bit-rate 4000000 /sdcard/screenrecord.mp4
Screen Recording with custom Bit Rate for the Video.
The Value "4000000" sets the Bitrate to 4Mbmps.
adb shell
<Hit Enter and then execute the following command>
cd /system
Changes the Directory to "/system".
adb shell
<Hit Enter and then execute the following command>
rm -f /sdcard/<filename.zip>
Deletes a File from your Android Device.
adb shell
<Hit Enter and then execute the following command>
crm -d /sdcard/example
Deletes a Folder from your Android Device.
mkdir /sdcard/Android
Creates a new Folder named "Android" under "/sdcard"
cp /sdcard/filename.apk /sdcard/FolderName/
To copy a File.
mv /sdcard/filename.apk /sdcard/FolderName/
To move a File.
mv /sdcard/filename.apk /sdcard/anotherfilename.apk
To rename a File.
adb shell
<Hit Enter and then execute the following command>
netstat
To check the Network Statistics of your Android Device.
adb shell
<Hit Enter and then execute the following command>
ip -f inet addr show wlan0
Displays your Phone’s Wi-Fi IP Address.
adb shell
<Hit Enter and then execute the following command>
top
Displays top CPU Processes running on your Android Device.
adb shell
<Hit Enter and then execute the following command>
getprop ro.build.version.sdk
Used to get the Properties of your Android’s build.prop Configuration.
adb shell
<Hit Enter and then execute the following command>
setprop net.dns1 1.2.3.4
Used to set Values to the Properties present in your Android’s build.prop Configuration.
----------------------------------------------------------------------------------------------------------------------
Fastboot Commands:
----------------------------------------------------------------------------------------------------------------------
fastboot devices
List all the Android Devices that are connected in Fastboot Mode to your Computer.
fastboot oem unlock
Unlocks the Bootloader on your Android Device (if the OEM allows).
fastboot oem lock
Relocks the Bootloader on your Android Device.
fastboot reboot bootloader
Reboots your Device into Fastboot/Bootloader Mode.
fastboot flash
Used to flash Files on your Android Device.
fastboot flash boot filename.img
Flashes boot Image on your Android Device’s Boot Partition.
fastboot flash recovery filename.img
Flashes Recovery Image on your Android Device’s Recovery Partition.
fastboot boot filename.img
Instead of flashing the File, this Command simply boots it (if the file is bootable).
Source:
https://www.xda-developers.com/what-is-adb/