List of All Widely Used ADB Commands - Tech Blogs
List of All Widely Used ADB Commands - Tech Blogs
com/list-of-all-widely-used-adb-commands/
(adb) commands are very useful while debugging any Android device but at
the same time it’s dif�cult to �nd all the commands at one place.
In this article, you will �nd 200+ ADB, shell and fastboot commands which are commonly used for
debugging Android devices. Using these commands can reduce the required efforts and can help
achieve the required result in less time.
Below is the list of commands which can be executed from command prompt or terminal on Android
devices while the device is connected with the computer with USB debugging turned on.
If anyone has used ADB in the past then they must have used ‘adb devices’ to list all the connected
devices. However, it’s not just limited to listing the devices, we can connect devices using wires or
wirelessly and even control the ADB server. Here are the few commands which can help to connect
and list the devices.
To list all devices connected via USB or To restart adb device in USB adb usb
mode
To set up port forwarding (sets up forwarding of computer port 6123 adb forward tcp�6123
to Android device port 7123) tcp�7123
To Set the target device to listen for a TCP/IP connection on port adb tcpip 5555adb
5555Connect a device using Wi-Fi network.Con�rm that your host connect 192.xxx.xxx.xxadb
computer is also connected to the Android device over Wi-Fi devices
Help Text: disconnect the USB cable from the Android device�nd
your Android device IP address at Settings > About phone > Status >
IP addressList of devices attached192.xxx.xxx.xx�5555 device
The basic operations which everyone perform using ADB commands are to install and uninstall
applications. ADB commands are also used to get the information of the applications installed on the
1 of 14 4/25/2024, 4:01 PM
List of all widely used ADB commands - Tech Blogs https://techblogs.42gears.com/list-of-all-widely-used-adb-commands/
device. Below are some ADB and shell commands to manage and get information about applications
on the device.
To list package name of all installed apks adb shell pm list packages
To list package name of all system apps adb shell pm list packages -s
To list package name of disabled apps on the adb shell pm list packages -d
device
2 of 14 4/25/2024, 4:01 PM
List of all widely used ADB commands - Tech Blogs https://techblogs.42gears.com/list-of-all-widely-used-adb-commands/
To list package name of only enabled apps on the adb shell pm list packages -e
device
To list package name of uninstalled apps from adb shell pm list packages -u
the device
While debugging an android device, rebooting the device or rebooting in the recovery mode or
bootloader mode is required for operations like sideloading any image or application. Below are some
commands to achieve the same.
To manually install OTA package using recovery mode adb sideload ota-update�le.zip
Logs and Bug Reports contain useful information related to application and are important for
developers while �xing bugs or making changes in the application. Here are some commands which
are useful for taking bug reports and collecting logs.
To wait for android device until the current process is completed adb wait-for-device
To list JDWP (Java Debug Wire Protocol) processes of android device adb jdwp
It’s always a good idea to take a backup of your device’s data so that it can be restored later whenever
3 of 14 4/25/2024, 4:01 PM
List of all widely used ADB commands - Tech Blogs https://techblogs.42gears.com/list-of-all-widely-used-adb-commands/
it’s required but if you are unlocking the bootloader or debugging the device then it’s highly
recommended to take backup. Here are some commands which can help you with the same.
To take backup of apps and settings adb backup -apk -all -f backup.ab
To take backup of applications and application settings adb backup -apk -shared -all -f
and shared storage backup.ab
To take backup of only third party applications. adb backup -apk -nosystem -all -f
backup.ab
Performing copy-paste using explorer requires a lot of time and also compared to ADB it’s a little
slow. You must have used ADB push and ADB pull for �le operations but here are some more
commands which can help you more with �le operations.
Information like screen resolution, pixel density and refresh rate are usually not getting displayed in
the device and to get such information the user has to struggle a lot in Android settings and it’s even
dif�cult to change it. Below are some commands to get the same information and change it using
shell.
4 of 14 4/25/2024, 4:01 PM
List of all widely used ADB commands - Tech Blogs https://techblogs.42gears.com/list-of-all-widely-used-adb-commands/
To get pixel density, screen resolution, refresh rate and DPI information of adb shell wm density
android device
To change screen resolution of android deviceNote: enter values based on adb shell wm size
the supported resolution of device 1080×2220
To change pixel density of android deviceNote: enter values based on the adb shell wm density
supported density of device 480
Using ADB, users can only perform 1 operation at a time on device storage but shell gives an
advantage here to move inside any directory and then perform any operations on the same folder.
Here are some important directories which are really useful.
To get IP address information of device’s WIFI adb shell<enter>ip -f inet addr show
wlan0
To get the list and monitor all process running on adb shell<enter>top
android device
Using shell commands users can get the information related to software and hardware for battery,
display and battery stat which are useful for building an application. Below are the commands to get
them.
5 of 14 4/25/2024, 4:01 PM
List of all widely used ADB commands - Tech Blogs https://techblogs.42gears.com/list-of-all-widely-used-adb-commands/
To get display information of device relating to software and hardware adb shell dumpsys display
con�guration
To get battery information of device relating to software and adb shell dumpsys
hardware con�guration battery
To get battery stats information of device relating to software and adb shell dumpsys
hardware con�guration batterystats
Screen Record functionality is not available with old android devices but shell scripts are there to
overcome that limitation. Also, some users don’t want to even touch the devices while the device is
connected for debugging. So, the user needs commands to perform all those operations from the
computer. Here are a few commands to perform those operations remotely from the computer.
To send SMS from android device using adb shell am start -a android.intent.action.SENDTO
ADB -d sms:<phonenumber> –es sms_body “<SMS
Text>” –ez exit_on_sent true
To start screen recording by de�ning adb shell screenrecord –size 1440 x 2960 /sdcard/
output resolution using ADB command. movie.mp4
Note�1. To stop the screen recording press
CTRL+C or COMMAND+C2. Enter
resolution values based on the supported
resolution of the device.
To start screen recording using ADB adb shell screenrecord –time-limit 36 /sdcard/
command and set recording duration. movie.mp4
Note: Replace ‘36’ with desired value in
seconds.
To start screen recording using ADB adb shell screenrecord –bit-rate 1500000 /sdcard/
command and set the bitrate of the video movie.mp4
output �le.
Most Android developers and testers want to automate actions on Android devices but it needs a
6 of 14 4/25/2024, 4:01 PM
List of all widely used ADB commands - Tech Blogs https://techblogs.42gears.com/list-of-all-widely-used-adb-commands/
separate setup to achieve it. While ADB provides some inbuilt commands to perform those actions.
Below are the key event commands of shell to perform action remotely from computer:
To press HOME button using ADB adb shell input keyevent 3oradb shell am start -W -c
android.intent.category.HOME -a
android.intent.action.MAIN
To press END CALL button using ADB adb shell input keyevent 6
To launch contacts list using ADB adb shell input keyevent 207
To turn down brightness level using adb shell input keyevent 220
ADB
To turn up brightness level using ADB adb shell input keyevent 221
7 of 14 4/25/2024, 4:01 PM
List of all widely used ADB commands - Tech Blogs https://techblogs.42gears.com/list-of-all-widely-used-adb-commands/
8 of 14 4/25/2024, 4:01 PM
List of all widely used ADB commands - Tech Blogs https://techblogs.42gears.com/list-of-all-widely-used-adb-commands/
9 of 14 4/25/2024, 4:01 PM
List of all widely used ADB commands - Tech Blogs https://techblogs.42gears.com/list-of-all-widely-used-adb-commands/
10 of 14 4/25/2024, 4:01 PM
List of all widely used ADB commands - Tech Blogs https://techblogs.42gears.com/list-of-all-widely-used-adb-commands/
11 of 14 4/25/2024, 4:01 PM
List of all widely used ADB commands - Tech Blogs https://techblogs.42gears.com/list-of-all-widely-used-adb-commands/
Fastboot enables options for users to �ash custom image and recovery �les using fastboot mode.
Some useful operations and it’s commands are listed below:
12 of 14 4/25/2024, 4:01 PM
List of all widely used ADB commands - Tech Blogs https://techblogs.42gears.com/list-of-all-widely-used-adb-commands/
To reboot device in fastboot or bootloader mode from fastboot fastboot reboot bootloader
mode
To �ash boot image using fastboot mode fastboot �ash boot boot.img
To boot custom Image in device without �ashing the image �le fastboot boot �lename.img
Device information such as IMEI, Serial Number and also �les available in device storage are
important for us but at the same time it’s not easy to �nd some of this information as it’s hidden for
users like system storage where �rmware �les are available. Some of this information are required
while debugging the device. Some commands to get this information are given below:
To print information related to connectivity like TCP Ip and adb shell netstat
connections
To print information of application activity by package and adb shell dumpsys activity
activity name <package>/<activity>
To list the information of all opened apps adb shell dumpsys package
packages
To get the path of application by package name adb shell path <package>
13 of 14 4/25/2024, 4:01 PM
List of all widely used ADB commands - Tech Blogs https://techblogs.42gears.com/list-of-all-widely-used-adb-commands/
To change battery level of device (emulator)Note: Value can adb shell dumpsys battery set
be 0 to 100 level <n>
To change battery status of device (emulator)Note: Value can adb shell dumpsys battery set
be 0 to 3 which relates to state unknown, charging, status<n>
discharging, not charging or full
To reset battery status of device (emulator) adb shell dumpsys battery reset
To change USB status of device (emulator)Note: Value can be adb shell dumpsys battery set usb
0 or 1 <n>
ADB is very useful. However, not being aware of some of these commands prevents users from
utilising this powerful tool. I hope these commands will help you while using ADB. There are still
some more commands which are not included here because of their limited and complicated use.. In
case you wish to learn more about all supported commands on your device then ‘adb –help’ can help.
©2024 42Gears Mobility Systems Pvt Ltd. All Rights Reserved. Terms Of Use (Website) Privacy Notice
14 of 14 4/25/2024, 4:01 PM