adb-cheatsheet
adb-cheatsheet copied to clipboard
Your journey to mastering Android™ Shell begins here - Source of Website: https://www.nr1.nu/android/
# Android™ Debug Bridge (adb)
Your journey to master Android™ Shell begins here
Time flies really, now its the the sixth time that I update this topic because now many new commands have been added that are adapted for the latest version of Android v13
. I didnt find any good help page for several years and the ones that have existed since before are obsolete and on the ones that existed before, there are a lot of commands that has been removed and there have also been added other commands in recent times.
Android is used in all kind of devices, tv, android boxes, media centers, routers, switches, smartphones, tabs, it's even used in your car and alot of more devices we can find android and if if we get hold of root and shell and can master android via cli then you probably understand what an incredible benefit you can get by learning adb, you don't have to become a master, it's enough that you know a little more than most people and you suddenly have incredible experience on your CV in 2022 and above all, you will have more fun with your devices:)
I have probably spent more then 1000
h working with android devices in cli and i still learning new things everyday
This wiki is up to date and we also cover new commands on Android 13
- Release date for Android v13: 15 August 2022
.
Android 12 FRP Bypass for All Samsung devices
Secret Codes™ Samsung Latest Models
Secret Code | Description | ADB Command |
---|---|---|
*#06# | IMEI number | com.sec.android.app.servicemodeapp/com.sec.android.app.modemui.activities.ShowIMEI |
*#0228# | Battery status | com.sec.android.app.factorykeystring/com.sec.android.app.status.BatteryStatus |
#0# | HW Module Test | com.sec.android.app.hwmoduletest/com.sec.android.app.hwmoduletest.HwModuleTest |
*#2222# | Service Mode | com.sec.android.RilServiceModeApp/com.sec.android.RilServiceModeApp.ServiceModeApp |
*#2663 | Touch FIrmware | com.sec.android.app.factorykeystring/com.sec.android.app.status.touch_firmware |
*#1234 | FIrmware info | com.sec.android.app.factorykeystring/com.sec.android.app.version.SimpleVersion |
? | WiFi Info | com.sec.android.app.servicemodeapp/com.sec.android.app.servicemodeapp.WifiInfoActivity |
Awesome Aliases For ADB
Copy and paste for add below aliases in ~/.bashrc
cat <<! > ~/.bashrc
#### Aliases for ADB
alias startintent="adb devices | tail -n +2 | cut -sf 1 | xargs -I X adb -s X shell am start $1"
alias apkinstall="adb devices | tail -n +2 | cut -sf 1 | xargs -I X adb -s X install -r $1"
alias rmapp="adb devices | tail -n +2 | cut -sf 1 | xargs -I X adb -s X uninstall $1"
alias clearapp="adb devices | tail -n +2 | cut -sf 1 | xargs -I X adb -s X shell pm clear $1"
!
Download Android™ Google Account Manager
Open Android™ Default Applications
You must visit https://wuseman.github.io/adb-cheatsheet/ to be able to open buttons
- Click to Open ADB Settings
- Click to Open - Device Set Screen Lock
- Click to Open - Device Settings
- Click to Open - Device Calculator
- Click to Open USB Settings
Open Android™ Samsung Applications
- Click to Open - Alliance Shield X in Galaxy Store
- Click to Open - Samsung Apps
- Click to Open - Samsung My Files
- Click to Open - Samsung Galaxy Store
- Click to Open - Samsung Smart Switch
- Click to Open - Samsung Secure Folder
- Click to Open - Samsung Biometrics Fingerprint ID
Open Android™ Google Applications
- Click to Open - Google Assistant
- Click to Open - Google Chrome Browser
- Click To Open - Google Search App
- Click to Open - Google Youtube App
- Click to Open - Google GMAIL
Open Android™ Motorola Applications
- Click to Open - Motorola Default Launcher
Open Android™ Xiamaoi Applications
- Click to Open Mi Manager
Open Android™ Secret Codes
- Click to Open UUISD Code - Show IMEI - #06
- Click to Open UUISD Code - Show Secret Diagnostic Mode - #0#
Android™ Source Code
Android™ Issue Tracker
Android Firmware Downloading
ADB Shell / Fastboot install
Source Files
- Download SDK Platform-Tools for Linux
- Download SDK Platform-Tools for MacOSX
- Download SDK Platform-Tools for Windows
MacOSX
1. Download the Android SDK Platform Tools ZIP file for macOS.
2. Extract the ZIP to an easily-accessible location (like the Desktop for example).
3. Open Terminal.
4. To browse to the folder you extracted ADB into, enter the following command: cd /path/to/extracted/folder/
5. For example, on my Mac it was this: cd /Users/Doug/Desktop/platform-tools/
6. Connect your device to your Mac with a compatible USB cable.
Change the USB connection mode to “file transfer (MTP)” mode.
This is not always required for every device, but it’s best to just leave it in this mode so you don’t run into any issues.
7. Once the Terminal is in the same folder your ADB tools are in, you can execute the following command to launch the ADB daemon: ./adb devices
8. On your device, you’ll see an “Allow USB debugging” prompt. Allow the connection.
9. Finally, re-enter the command from step #7. If everything was successful,
you should now see your device’s serial number in macOS’s Terminal window.
Linux
1. Download the Android SDK Platform Tools ZIP file for Linux.
2. Extract the ZIP to an easily-accessible location (like the Desktop for example).
3. Open a Terminal window.
4. Enter the following command: cd /path/to/extracted/folder/
5. This will change the directory to where you extracted the ADB files.
6. So for example: cd /Users/Doug/Desktop/platform-tools/
7. Connect your device to your Linux machine with your USB cable.
Change the connection mode to “file transfer (MTP)” mode.
This is not always necessary for every device, but it’s recommended so you don’t run into any issues.
8. Once the Terminal is in the same folder your ADB tools are in, you can execute the following command to launch the ADB daemon: ./adb devices
9. Back on your smartphone or tablet device, you’ll see a prompt asking you to allow USB debugging. Go ahead and grant it.
Windows 10
1: Download: https://dl.google.com/android/repository/platform-tools-latest-windows.zip
2: Extract the contents of this ZIP file into an easily accessible folder (such as C:\platform-tools)
3: Open Windows explorer and browse to where you extracted the contents of this ZIP file
4: Then open up a Command Prompt from the same directory as this ADB binary. This can be done by holding
Shift and Right-clicking within the folder then click the “Open command window here” option.
5: Connect your smartphone or tablet to your computer with a USB cable.
Change the USB mode to “file transfer (MTP)” mode. Some OEMs may or may not require this,
but it’s best to just leave it in this mode for general compatibility.
6: In the Command Prompt window, enter the following command to launch the ADB daemon: adb devices
7: On your phone’s screen, you should see a prompt to allow or deny USB Debugging access. Naturally,
you will want to grant USB Debugging access when prompted (and tap the always allow check box if you never want to see that prompt again).
8: Finally, re-enter the command from step #6. If everything was successful,
you should now see your device’s serial number in the command prompt (or the PowerShell window).
Arch Linux
pacman -S android-tools
Gentoo (android-tools includes fastboot)
emerge --ask dev-util/android-sdk-update-manager dev-util/android-tools
Fedora
dnf install adb
Ubuntu
apt install adb fastboot -y
Android™ files
SMS and Phone Phone logs is stored in below files
/data/user_de/0/com.android.providers.telephony/databases/mmssms.db
/data/user_de/0/com.android.providers.telephony/databases/telephony.db
Audio files is stored in
/system/media/audio/ui/
/system/media/audio/ringtones
/system/media/audio/notifications
When you unlock your device your device will save encryption key in
/keyrefuge/misc/vold/user_keys/ce/0/current
Backup all Partitions from /dev/block/by-name on your PC (root required)
for partitions in $(ls /dev/block/by-name/); do
"su -c dd if=/dev/block/by-name/partitions"|dd of=${partitions}.img;
done
ADB Shell commands
Start ADB server:
adb start-server
Stop ADB server:
adb stop-server
Kill ADB server:
adb kill-server
Setup ADB server via Wi-Fi
adb tcpip <port>
Connect to ADB server:
adb connect <device_ip>
Restarts the adbd daemon listening on USB
adb usb
List Connected Devices:
adb devices
Get Status:
adb get-state
Print Serial Number:
adb get-serialno
Backup Device:
adb backup -all
Restore Device:
adb restore /path/to/backupflile.adb
Enter ADB shell:
adb shell
Enter if there is multiple devices connected:
adb -s <id_from_adb_devices> shell
To print device serial no:
adb get-serialno
Create a bugreport:
adb bugreport
Install an app:
adb install <apk_file>
Install an app and keep all it's data from a previous setup:
adb install -r <apk_file>
Uninstall an app:
adb uninstall <apk_file>
Transfer a file from PC > Device
adb push mypicture.png /storage/on/device
Transfer a file from Device > PC
adb push myfolder /storage/on/device
Pull a file
adb pull = tansfer a file: device > pc
adb pull /storage/on/device/mypicture.png /path/on/pc
Pull a folder (Transfer a folder FROM device > pc)
adb pull /storage/on/device /path/on/pc
Pull installed apk files
- Script for pull all installed Apks
- Script for pull all installed system Apks
- Script for pull all Apks installed by you
Pull all files inside a folder to a path (Transfer all files in a folder FROM device > pc)
adb pull /storage/on/device/ /path/on/pc # Notice the trial slash
ADB Shell exec-out
Stream Device Screen on your PC
adb exec-out screenrecord --Example Output-format=h264 - \
| prefered tool - <stdin>
Stream via Mplayer (Recommended)
Recommended since it is starts immediately, very little delay, and doesn't freak out like vlc.
adb exec-out screenrecord \
--output-format=h264 - \
|ffplay \
-framerate 60 \
-probesize 32 \
-sync video -
- ffplay works, but it seems to take a few seconds to decide to start, and ends up lagging well behind the entire time.
Stream via FFPLay
FFPlay Default - No Settings
adb shell screenrecord --Example Output-format=h264 - | ffplay -
FFplay Customized
adb exec-out screenrecord \
--Example Output-format=h264 - \
|ffplay \
-framerate 60 \
-probesize 32 \
-sync video -
adb shell screenrecord \
--bit-rate=16m \
--Example Output-format=h264 \
--size 800x600 - \
|ffplay \
-framerate 60 \
-framedrop \
-bufsize 16M -
FFplay Customized - Stream vin 1080p
adb exec-out screenrecord \
--bit-rate=16m \
--Example Output-format=h264 \
--size 1920x1080 -
ADB Shell network
Sniff your device network and SMS traffic via Wireshark on your PC
Via Shell
adb shell su -c tcpdump -nn -i wlan0 -U -s0 -w - \
'not port 5555' \
|wireshark -k -i -
Via exec-out
adb exec-out "su -c tcpdump -i any -U -w - 2>/dev/null" \
|wireshark -k -S -i -
ADB Shell reboot
System
adb reboot
Recovery
adb reboot recovery
Bootloader
adb reboot bootloader
Fastboot (some brands)
adb reboot fastboot
ADB Shell date
Set date
adb shell date MMDDYYYY.XX;am broadcast \
-a android.intent.action.TIME_SET
ADB Shell cmd
Send notify and push notice to notification bar
adb shell su -lp 2000 -c "cmd notification post -S bigtext \
-t 'adb pwnz' 'Tag' 'it rly does'"
!!! Notice "when lock screen is set, all commands require the --old <CREDENTIAL> argument."
ADB Shell cmd lock_settings
Sets the package name for server based resume on reboot service provider.
adb shell cmd lock_settings set-resume-on-reboot-provider-package <package_name>
Removes cached unified challenge for the managed profile.
adb shell cmd lock_settings remove-cache \
--user 0
Verifies the lock credentials.
adb shell cmd lock_settings verify \
--old 1234 --user 0
Clears the lock credentials.
adb shell cmd lock_settings clear \
--old 1234 --user 0
Enables / disables synthetic password.
adb shell cmd lock_settings sp \
--old 1234 \
--user 0 <1|0>
Gets whether synthetic password is enabled.
adb shell cmd lock_settings sp \
--old 1234 \
--user 0
Sets the lock screen as password, using the given PASSOWRD to unlock.
adb shell cmd lock_settings set-password \
--old 1234 \
--user 0 'newPassword`
Sets the lock screen as PIN, using the given PIN to unlock.
adb shell cmd lock_settings set-pin \
--old 1234 \
--user 0 `newPin`
Sets the lock screen as pattern, using the given PATTERN to unlock.
adb shell cmd lock_settings set-pattern \
--old 1234 \
--user 0 `newPattern`
When true, disables lock screen.
adb shell cmd lock_settings set-disabled \
--old 1234 \
--user 0 `true|false`
```
##### Checks whether lock screen is disabled.
```sh
adb shell cmd lock_settings get-disabled \
--old 1234 \
--user 0
ADB Shell cmd testharness
About:
Test Harness Mode is a mode that the device can be placed in to prepare
the device for running UI tests. The device is placed into this mode by
first wiping all data from the device, preserving ADB keys.
By default, the following settings are configured:
* Package Verifier is disabled
* Stay Awake While Charging is enabled
* OTA Updates are disabled
* Auto-Sync for accounts is disabled
Other apps may configure themselves differently in Test Harness Mode by
checking ActivityManager.isRunningInUserTestHarness()
Test Harness Mode commands:
help
Print this help text.
enable|restore
Erase all data from this device and enable Test Harness Mode,
preserving the stored ADB keys currently on the device and toggling
settings in a way that are conducive to Instrumentation testing.
ADB Shell cmd stats
start
adb shell cmd stats print-stats
Send a broadcast that triggers the subscriber to fetch metrics.
adb shell cmd stats send-broadcast `uid` `name`
cmd stats send-broadcast [UID] NAME
UID The uid of the configuration. It is only possible to pass
the UID parameter on eng builds. If UID is omitted the
calling uid is used.
NAME The name of the configuration
Flushes all data on memory to disk.
adb shell cmd stats write-to-disk
Prints the UID, app name, version mapping.
adb shell cmd stats print-uid-map
Log a binary push state changed event.
adb shell cmd stats log-binary-push NAME VERSION STAGING ROLLBACK_ENABLED LOW_LATENCY STATE EXPERIMENT_IDS
NAME The train name.
VERSION The train version code.
STAGING If this train requires a restart.
ROLLBACK_ENABLED If rollback should be enabled for this install.
LOW_LATENCY If the train requires low latency monitoring.
STATE The status of the train push.
Integer value of the enum in atoms.proto.
EXPERIMENT_IDS Comma separated list of experiment ids.
Leave blank for none.
Hide all notifications icons on Status Bar
adb shell cmd statusbar send-disable-flag notification-icons
Reset all flags to default
adb shell cmd statusbar send-disable-flag none
Print Status Bar Icons
adb shell cmd statusbar get-status-icons
Print Preferences for Status Bar
adb shell cmd statusbar prefs list-prefs
Expand Status Bar
adb shell cmd statusbar expand-notifications
Collapse Status Bar
adb shell cmd statusbar collapse
Expand Full Settings
adb shell cmd statusbar expand-settings
Status Bar Help
adb shell cmd statusbar help
Print auth user
adb shell cmd user list
Enable night mode (Dark Mode)
adb shell cmd uimode night yes
Disable night mode
adb shell cmd uimode night no
Enable car Mode
adb shell cmd uimode car yes
Disable car (car Mode)
adb shell cmd uimode car no
Scan for nearby ssid:s, give it 7 seconds for scan and fetch some wifi data
#!/bin/bash
adb shell cmd -w wifi start-scan
sleep 7
adb shell cmd -w wifi list-scan-results
Sets whether we are in the middle of an emergency call.
Equivalent to receiving the TelephonyManager.ACTION_EMERGENCY_CALL_STATE_CHANGED
broadcast.
adb shell cmd -w wifi set-emergency-call-state `enabled|disabled`
Sets whether Emergency Callback Mode (ECBM) is enabled.
adb shell cmd -w wifi set-emergency-callback-mode `enabled|disabled`
Lists the suggested networks from the app
adb shell cmd -w wifi list-suggestions-from-app `com.app.example`
Lists all suggested networks on this device
adb shell cmd -w wifi list-all-suggestions
!!! Note "This only returns whether the app was set via the 'network-requests-set-user-approved' shell command"
- Queries whether network requests from the app is approved or not.
adb shell cmd -w wifi network-requests-has-user-approved `com.app.example`
Note: Only 1 such app can be approved from the shell at a time
- Sets whether network requests from the app is approved or not.
adb shell cmd -w wifi network-requests-set-user-approved `com.app.example` yes|no
Lists the requested networks added via shell
adb shell cmd -w wifi list-requests
Removes all active requests added via shell
adb shell cmd -w wifi remove-all-requests
Remove a network request with provided SSID of the network
adb shell cmd -w wifi remove-request <ssid>
Add a network request with provided params
adb shell cmd -w wifi add-request <ssid> open|owe|wpa2|wpa3 [<passphrase>] [-b <bssid>]
Initiates wifi settings reset
adb shell cmd -w wifi settings-reset
Gets softap supported features. Will print 'wifi_softap_acs_supported'
adb shell cmd -w wifi get-softap-supported-features
Gets setting of wifi watchdog trigger recovery.
adb shell cmd -w wifi get-wifi-watchdog
Sets whether wifi watchdog should trigger recovery
adb shell cmd -w wifi set-wifi-watchdog `enabled|disabled`
Sets country code to or left for normal value
adb shell cmd -w wifi force-country-code enabled <two-letter code> | disabled
Manually triggers a link probe.
adb shell cmd -w wifi send-link-probe
Clears the user disabled networks list.
adb shell cmd -w wifi clear-user-disabled-networks
Removes all user approved network requests for the app.
adb shell cmd -w wifi network-requests-remove-user-approved-access-points \
`com.app.example`
Clear the user choice on Imsi protection exemption for carrier
adb shell cmd -w wifi imsi-protection-exemption-clear-user-approved-for-carrier \
<carrier id>
Queries whether Imsi protection exemption for carrier is approved or not
adb shell cmd -w wifi imsi-protection-exemption-has-user-approved-for-carrier \
<carrier id>
Sets whether Imsi protection exemption for carrier is approved or not
adb shell cmd -w wifi imsi-protection-exemption-set-user-approved-for-carrier \
<carrier id> yes|no
Queries whether network suggestions from the app is approved or not.
adb shell cmd -w wifi network-suggestions-has-user-approved `com.app.example`
Sets whether network suggestions from the app is approved or not.
adb shell cmd -w wifi network-suggestions-set-user-approved \
`com.app.example` yes|no
Sets whether low latency mode is forced or left for normal operation.
adb shell cmd -w wifi force-low-latency-mode `enabled|disabled`
Sets whether hi-perf mode is forced or left for normal operation.
adb shell cmd -w wifi force-hi-perf-mode `enabled|disabled`
Gets current interval between RSSI polls, in milliseconds.
adb shell cmd -w wifi get-poll-rssi-interval-msecs
Sets the interval between RSSI polls to <int>
milliseconds.
adb shell cmd -w wifi set-poll-rssi-interval-msecs `<int>`
Gets setting of CMD_IP_REACHABILITY_LOST
events triggering disconnects.
Equivalent to receiving the TelephonyManager.ACTION_EMERGENCY_CALL_STATE_CHANGED
broadcast,
sets whether we are in the middle of an emergency call.
adb shell cmd -w wifi set-emergency-call-state `enabled|disabled`
Equivalent to receiving the TelephonyManager.ACTION_EMERGENCY_CALLBACK_MODE_CHANGED broadcast.
adb shell cmd -w wifi set-emergency-callback-mode `enabled|disabled`
Lists the suggested networks from the app
adb shell cmd -w wifi list-suggestions-from-app `com.app.example`
Lists all suggested networks on this device
adb shell cmd -w wifi list-all-suggestions
Notice: This only returns whether the app was set via the 'network-requests-set-user-approved' shell command
Queries whether network requests from the app is approved or not
adb shell cmd -w wifi network-requests-has-user-approved `com.app.example`
Note: Only 1 such app can be approved from the shell at a time
Sets whether network requests from the app is approved or not.
adb shell cmd -w wifi network-requests-set-user-approved `com.app.example` yes|no
Lists the requested networks added via shell
adb shell cmd -w wifi list-requests
Removes all active requests added via shell
adb shell cmd -w wifi remove-all-requests
Remove a network request with provided SSID of the network
adb shell cmd -w wifi remove-request <ssid>
Add a network request with provided params
adb shell cmd -w wifi add-request <ssid> \
open|owe|wpa2|wpa3 [<passphrase>] \
[-b <bssid>]
Initiates wifi settings reset
adb shell cmd -w wifi settings-reset
and/or 'wifi_softap_wpa3_sae_supported', each on a separate line.
adb shell cmd -w wifi get-softap-supported-features
Gets setting of wifi watchdog trigger recovery.
adb shell cmd -w wifi get-wifi-watchdog
Sets whether wifi watchdog should trigger recovery
adb shell cmd -w wifi set-wifi-watchdog `enabled|disabled`
Sets country code to or left for normal value
adb shell cmd -w wifi force-country-code enabled <two-letter code> | disabled
Sets whether soft AP channel is forced to MHz
adb shell cmd -w wifi force-softap-channel enabled <int> | disabled
Manually triggers a link probe.
adb shell cmd -w wifi send-link-probe
Clears the user disabled networks list.
adb shell cmd -w wifi clear-user-disabled-networks
Removes all user approved network requests for the app.
adb shell cmd -w wifi network-requests-remove-user-approved-access-points `com.app.example`
Clear the user choice on Imsi protection exemption for carrier
adb shell cmd -w wifi imsi-protection-exemption-clear-user-approved-for-carrier <carrier id>
Queries whether Imsi protection exemption for carrier is approved or not
adb shell cmd -w wifi imsi-protection-exemption-has-user-approved-for-carrier <carrier id>
Sets whether Imsi protection exemption for carrier is approved or not
adb shell cmd -w wifi imsi-protection-exemption-set-user-approved-for-carrier <carrier id> yes|no
List uid owner of a package
adb shell cmd package list packages -U
List packages a.k.a: pm list packages
adb shell cmd package list packages -l
List disabled packages
adb shell cmd package list packages -d
Filter to only show enabled packages
adb shell cmd package list packages -e
Filter to only show third party packages
adb shell cmd package list packages -3
Set the default home activity (aka launcher)
adb shell cmd package set-home-activity [--user USER_ID] TARGET-COMPONENT
Prints all features of the system
adb shell cmd package list features
Print briefs
adb shell cmd package resolve-activity --brief com.facebook.katana
ADB Shell pm
Disable AutoUpdate for any Package
adb shell pm disable-user –user 0 <package_name>
Disable AutoUpdate for all applications
adb shell pm disable-user com.android.vending
Print all applications in use
adb shell pm list packages|sed -e "s/package://"
|while read x; do
cmd package resolve-activity --brief $x \
|tail -n 1 \
|grep -v "No activity found"
done
List all packages installed on device
adb shell pm list packages
List enabled packages
adb shell pm list packages -e
List disabled packages
adb shell pm list packages -d
List third party packages installed by user
adb shell pm list packages -3
List users
adb shell pm list users
List permission groups
adb shell pm list permission-groups
List features
adb shell pm list features
Uninstall any installed package:
adb shell pm uninstall --user 0 com.package.name
Uninstall multiple apps:
for packages in com.package1 com.package2; do
adb shell pm uninstall --user 0 "${packages}"
done
Clear application data:
adb shell pm clear PACKAGE_NAME
List permission groups:
adb shell pm list permission-groups
List instrumentation:
adb shell pm list instrumentation
Grant permission to an app (Example Only For Grant):
adb shell pm grant com.application android.permission.READ_LOGS
Revoke permission to an app (Example Only For Revoke):
adb shell pm revoke com.application android.permission.READ_LOGS
Reset all permissions for an app:
adb shell pm reset-permissions -p your.app.package
ADB Shell logcat
* V — Verbose (lowest priority)
* D — Debug
* I — Info (default priority)
* W — Warning
* E — Error
* F — Fatal
* S — Silent (highest priority, on which nothing is ever printed)
Log buffer containing all buffer logs
adb logcat -b all -c color
Print all ŕaido info
adb logcat -v threadtime -b radio -d \
-f /data/log/radio_*.log
Log buffer containing radio and telephony messages
adb logcat -b radio -c color
Log buffer containing events
adb logcat -b events -c color
Log buffer contains multi values is possible
adb logcat -b main -b radio -b events
You can use , for separator
adb logcat -b main,radio,events
Show log buffer event descriptions
adb logcat -v descriptive -v color
Display time in seconds starting from Jan 1, 1970.
adb logcat -v epoch -v color
Display time in CPU seconds starting from the last boot.
adb logcat -v monotonic -v color
Ensure that any binary logging content is escaped.
adb logcat -v printable -v color
Use -v time for print timestamps, and threadtime for dates:
adb logcat -v time
adb logcat -v threadtime
For get Example Output colorized with logcat:
adb logcat -v color
Displays current log buffer sizes:
adb logcat -g
Sets the buffer size (K or M):
adb logcat -G 16M
Clear the log buffer:
adb logcat -c
Enables ALL log messages (verbose mode)
adb logcat *:V
Dumps data to specified file
adb logcat -f <filename>
Display PID with the log info
adb logcat -v process
Display the raw log message, with no other metadata fields
adb logcat -v raw
Display the date, invocation time, priority/tag, and PID of the process issuing the message
adb logcat -v time
Display the priority, tag, and the PID and TID of the thread issuing the message
adb logcat -v thread
Display the date, invocation time, priority, tag, and the PID and TID of the thread issuing the message
adb logcat -v threadtime
Display all metadata fields and separate messages with blank lines
adb logcat -v long
Log multiple options (-b ... -b ....):
adb logcat -b main -b radio -b events
Run all at once, no reason for use it like this really
adb logcat \
-v brief \
-v long \
-v process \
-v raw \
-v tag \
-v thread \
-v threadtime \
-v time \
-v color
Print logs from locks_ettings
adb logcat \
|grep "LockSettingsService\
|LockPatternUtilsKeyStorage\
|vold\
|vold\
|keystore2\
|keymaster_tee\
|LockSettingsService\
|vold_prepare_subdirs"
ADB Shell dumpsys
Get a nice output from dumpsys
adb shell dumpsys -l \
|sed 's/^ /adb shell dumpsys/g;G'
Get a help cheatsheet fast
adb shell dumpsys -l\
|sed 's/^ /adb shell dumpsys/g;s/$/ -h/g;G'
Execute all dumpsys help
adb shell dumpsys appops -h \
|sed 's/--/adb shell --/g;s/ /### /g' \
Print this help text
adb shell dumpsys appops --op [OP]
Limit output to data associated with the given app op code
adb shell dumpsys appops--mode [MODE]
Limit output to data associated with the given app op mode
adb shell dumpsys appops--package [PACKAGE]
Limit output to data associated with the given package name
adb shell dumpsys appops--attributionTag [attributionTag]
Limit output to data associated with the given attribution tag
adb shell dumpsys appops--include-discrete [n]
Include discrete ops limited to n per dimension. Use zero for no limit
adb shell dumpsys appops--watchers
Only output the watcher sections
adb shell dumpsys appops--history
Only output history
Dumpsys Security Stuff stuff
adb shell dumpsys android.system.keystore2.IKeystoreService/default
adb shell dumpsys android.security.samsungattestation
adb shell dumpsys android.security.metrics
adb shell dumpsys android.security.maintenance
adb shell dumpsys android.security.legacykeystore
adb shell dumpsys android.security.identity
adb shell dumpsys android.security.compat
adb shell dumpsys android.security.authorization
adb shell dumpsys android.security.apc
Dumpsys powerstats info
adb shell dumpsys powerstats
Dumpsys power info
adb shell dumpsys power
Dumpsys Permission Permissions
adb shell dumpsys permission
adb shell dumpsys permission_checker
adb shell dumpsys permissionmgr
Dumpsys password policyś
adb shell dumpsys password_policy
Dumpsys Device FeatureS/Perfomance/Tracker/Info etc
adb shell dumpsys phone
Grep temperatures
adb shell dumpsys thermalservice
Dumpsys usagestats for an app
adb shell dumpsys usagestats com.bankid.bus
Dump current USB state or issue command:
Example USB type C port role switch:
dumpsys usb set-port-roles "default" source device
Example USB type C port simulation with full capabilities:
dumpsys usb add-port "matrix" dual
dumpsys usb connect-port "matrix" ufp? sink? device?
dumpsys usb ports
dumpsys usb disconnect-port "matrix"
dumpsys usb remove-port "matrix"
dumpsys usb reset
Example USB type C port where only power role can be changed:
dumpsys usb add-port "matrix" dual
dumpsys usb connect-port "matrDumpsysix" dfp source? host
dumpsys usb reset
Example USB OTG port where id pin determines function:
dumpsys usb add-port "matrix" dual
dumpsys usb connect-port "matrix" dfp source host
dumpsys usb reset
Example USB device-only port:
dumpsys usb add-port "matrix" ufp
dumpsys usb connect-port "matrix" ufp sink device
dumpsys usb reset
Example simulate contaminant status:
dumpsys usb add-port "matrix" ufp
dumpsys usb set-contaminant-status "matrix" true
dumpsys usb set-contaminant-status "matrix" false
Example USB device descriptors:
dumpsys usb dump-descriptors -dump-short
dumpsys usb dump-descriptors -dump-tree
dumpsys usb dump-descriptors -dump-list
dumpsys usb dump-descriptors -dump-ra
Dumpsys procstats
adb shell dumpsys procstats
Dumpsys procstats with full stats
adb shell dumpsys procstats --full-stats
Dumpsys procstats csv-mem normal
adb shell dumpsys procstats --csv-mem norm
Dumpsys Package
adb shell dumpsys package com.android.chrome
Print current application in use (Android 12/13)
dumpsys activity|grep -i mCurrentFocus|awk 'NR==1{print $3}'|cut -d'}' -f1
Dumpsys Activity Help
adb shell dumpsys perm
Dumpsys Activity Activities
adb shell dumpsys a
Dumpsys Activity Broadcasts
adb shell dumpsys activity broadcast
Dumpsys Broadcast Stats
adb shell dumpsys activity broadcast-stats
Dumpsys Pending Intent
adb shell dumpsys activity i
Dumpsys Activity Processes
adb shell dumpsys activity p
Dumpsys Activity Out Of Mem
adb shell dumpsys activity o
Dumpsys Activity Services
adb shell dumpsys activity services
Dumpsys Activity Asociations
adb shell dumpsys activity as
Dumpsys Activity LRU Services
adb shell dumpsys activity lru
Dumpsys Activity LRU Services
adb shell dumpsys activity lru
Dumpsys Activity binder-proxies stats on binder objects and IPCs
adb shell dumpsys activity binder-proxies
Dumpsys Activity settings currently applied config settings
adb shell dumpsys activity settings
Dumpsys Activity service client-side state
adb shell dumpsys activity service
Dumpsys Activity package [PACKAGE_NAME]: all state related to given package
adb shell dumpsys activity package
Dumpsys Activity all: dump all activities
adb shell dumpsys activity all
Dumpsys Activity top: dump the top activity
adb shell dumpsys activity top
Include all available server state
adb shell dumpsys activity -a
Dumpsys Activity and include client state
adb shell dumpsys activity -c
Dumpsys Activity all limit output to given package
adb shell dumpsys activity -p
Dumpsys Activity all output checkin format, resetting data
adb shell dumpsys activity --checkin
Dumpsys Activity output checkin format, not resetting data
adb shell dumpsys activity --C
Dumpsys All Activitys data
adb shell dumpsys activity --proto
Dumpsys Activity dump just the autofill-related state of an activity
adb shell dumpsys activity --autofill
Dumpsys Activity Help
adb shell dumpsys activity recents
Dumpsys Activity Exit Info
adb shell dumpsys activity exit-info
Dumpsys Activity LMK KILLS
adb shell dumpsys activity lmk
Dumpsys Activity Help
adb shell dumpsys activity recents
Dumpsys Activity Permissions
adb shell dumpsys activity top
Dumpsys Activity
adb shell dumpsys activity top
Dumpsys Activity Top
adb shell dumpsys activity top
List all active services:
adb shell dumpsys -l
List services on older devices via command below
adb shell dumpsys -l |sed 's/^ / /g'
Currently running services:
AAS
AODManagerService
CCM
CocktailBarService
CodecSolution
CustomFrequencyManagerService
DeviceRootKeyService
DirEncryptService
DisplaySolution
DockObserver
EngineeringModeService
HqmManagerService
ImsBase
OcfKeyService
ReactiveService
SEAMService
SamsungKeyProvisioningManagerService
SatsService
SecExternalDisplayService
Dumpsys lock_settings
adb shell dumpsys lock_settings
Current lock settings service state:
User State:
User 0
SP Handle: 5f0ef3437a85f55
Last changed: 2021-07-28 20:22:36 (b8212446331f2358)
SID: 3fffcda35ee6c180
Quality: 0
CredentialType: Pin
SeparateChallenge: true
Metrics: known
Storage:
User 0 [/data/system_de/0/spblob]:
5 2021-07-28 20:22:36 05f0ef3437a85f55.weaver
31 2021-07-28 20:22:36 05f0ef3437a85f55.pwd
72 2021-07-28 20:22:36 05f0ef3437a85f55.metrics
186 2021-07-28 20:22:36 05f0ef3437a85f55.spblob
58 2021-07-28 20:22:36 0000000000000000.handle
StrongAuth:
PrimaryAuthFlags state:
userId=0, primaryAuthFlags=0
NonStrongBiometricAllowed state:
RebootEscrow:
mRebootEscrowWanted=false
mRebootEscrowReady=false
mRebootEscrowListener=com.android.server.recoverysystem.RecoverySystemService@bc1c4d8
mPendingRebootEscrowKey is not set
Print codecs for bluetooth headphones
adb shell dumpsys media.audio_flinger | grep -A3 Input
Show bluetooth macaddr, bluetooth name and such things
adb shell dumpsys bluetooth_manager
Dump phone registry
adb shell dumpsys telephony.registry
Dump GPS Data:
adb shell dumpsys dumpsys location
Dump Settings
adb shell dumpsys settings
_id:225 name:lock_screen_show_notifications pkg:com.android.settings value:1
_id:6 name:volume_bluetooth_sco pkg:android value:7 default:7
_id:192 name:ringtone_set pkg:com.google.android.gsf value:1
_id:159 name:lock_screen_allow_rotation pkg:android value:0
_id:2997 name:Flashlight_brightness_level pkg:com.android.systemui value:1001
_id:67 name:SEM_VIBRATION_NOTIFICATION_INTENSITY pkg:android value:5
_id:175 name:call_popup pkg:android value:0 default:0
_id:59 name:install_non_market_apps pkg:android value:1 default:1
Display Contacts On Sim Card
adb shell dumpsys simphonebook
Show hardware info as thermal stuff for cpu, gpu and battery
adb shell dumpsys hardware_properties
****** Dump of HardwarePropertiesManagerService ******
CPU temperatures: [38.0, 38.0]
CPU throttling temperatures: [55.0, 76.0]
CPU shutdown temperatures: [115.0, 115.0]
Print all applications that is using your email address
adb shell dumpsys account \
|grep -i com.*$ -o\
|cut -d' ' -f1\
|cut -d} -f1|grep -v com$
com.microsoft.workaccount
com.skype.raider
com.samsung.android.mobileservice
com.facebook.messenger
com.google.android.gm.exchange
Show all notifications listener and so on:
adb shell dumpsys notification
Print all added email addresses from all applications
adb shell dumpsys \
|egrep -o "\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b"
Print version of a specifik package
adb shell dumpsys dumpsys package com.lge.signboard | grep versionName
versionName=6.00.170603-0
Check state for screen and figoure how device was unlcked last time:
adb shelldumpsys user
State: RUNNING_UNLOCKED
Last logged in fingerprint
agree Knox Privacy Policy: false
And for example, you can dump data for all of the running services, dump all data for battery:
adb shell dumpsys battery
Dump stats for your battery:
adb shell dumpsys atterystats
Erase old stats for battery:
adb shell dumpsys batterystats --reset
Sort Applications By Ram Usage:
adb shell dumpsys meminfo
Applications Memory Usage (in Kilobytes):
Uptime: 29602806 Realtime: 57806941
Total PSS by process:
265,435K: com.android.systemui (pid 4190)
264,671K: system (pid 3838)
171,192K: surfaceflinger (pid 3360)
152,523K: [email protected] (pid 3338)
128,781K: com.sec.android.app.launcher (pid 5597 / activities)
92,656K: se.kronansapotek.kronan (pid 26729 / activities)
84,563K: logd (pid 3203)
80,944K: com.google.android.talk (pid 32314 / activities)
79,754K: com.google.android.googlequicksearchbox:search
Unplug AC:
adb shell dumpsys battery unplug
Print how many notifications you have:
adb shell dumpsys notification | grep NotificationRecord | wc -l
ADB Shell dumpstate
Dump info about your sim provider and kernel bootloader ID etc.
adb shell dumpstate -v
========================================================
== dumpstate: 2019-08-30 19:31:05
========================================================
Build: PPR1.180610.011.G950FXXS5DSF1
Build fingerprint: 'samsung/dreamltexx/dreamlte:9/PPR1.180610.011/G950FXXS5DSF1:user/release-keys'
Bootloader: G950FXXS5DSF1
Radio: G950FXXS5DSF1
Network: Comviq
Linux version 4.4.111-16019454 (dpi@21DHA724) (gcc version 4.9.x 20150123 (prerelease)
(GCC) ) #1 SMP PREEMPT Mon Jun 3 20:16:50 KST 2019
Kernel: Command line: (unknown)
up 0 weeks, 0 days, 16 hours, 21 minutes
Uptime: Bugreport format version: 2.0
Dumpstate info: id=0 pid=26940 dry_run=0 args=dumpstate -v extra_options=
ADB Shell am
Send simple notification
adb shell am broadcast \
-n your.package.name/com.google.firebase.iid.FirebaseInstanceIdReceiver \
-c your.package.name \
-a com.google.android.c2dm.intent.RECEIVE
Send notification
adb shell am broadcast \
-n com.android.google.youtube/com.google.firebase.iid.FirebaseInstanceIdReceiver \
-a "com.google.android.c2dm.intent.RECEIVE" }-es "title" "Title" --es "body" "Body"
How to send push notification locally using ADB without need network connection.
adb shell am broadcast \
-n com.your.app/com.google.firebase.iid.FirebaseInstanceIdReceiver \
-a "com.google.android.c2dm.intent.RECEIVE" \
--es "extra1" "65" \
--es "guid" "1f400184-9215-479c-b19a-a9cd9a1d9dc9" \
--es "extra3" "VALUE" \
--es "extra4" "'Long string with spaces'"
How to use Demo Mode
First you enable the Demo Mode:
adb shell settings put global sysui_demo_allowed 1
Display time 12:00
adb shell am broadcast -a com.android.systemui.demo \
-e command clock -e hhmm 1200
Display full mobile data without type
adb shell am broadcast -a com.android.systemui.demo \
-e command network -e mobile show -e level 4 -e datatype false
Hide notifications
adb shell am broadcast -a com.android.systemui.demo \
-e command notifications -e visible false
Show full battery but not in charging state
adb shell am broadcast -a com.android.systemui.demo \
-e command battery -e plugged false -e level 100
Exit Demo Mode
adb shell am broadcast -a com.android.systemui.demo
-e command exit
Add a value to default shared preferences.
adb shell am broadcast \
-a org.example.app.sp.PUT \
--es key key_name \
--es value "hello world!"'
Remove a value to default shared preferences.
adb shell am broadcast \
-a org.example.app.sp.REMOVE \
--es key key_name'
Clear all default shared preferences.
adb shell am broadcast \
-a org.example.app.sp.CLEAR \
--es key key_name'
It's also possible to specify shared preferences file.
adb shell am broadcast \
-a org.example.app.sp.PUT \
--es name Game \
--es key level \
--ei value 10'
Play a mp3 track on device
adb shell am start \
-a android.intent.action.VIEW \
-d file:////storage/9A8A-1069/wuseman/ringtones/<mp3_track>.mp3
-t audio/mp3
Data types
adb shell am broadcast \
-a org.example.app.sp.PUT \
--es key string \
--es value "hello world!"'
adb shell am broadcast \
-a org.example.app.sp.PUT \
--es key boolean \
--ez value true'
adb shell am broadcast \
-a org.example.app.sp.PUT \
--es key float \
--ef value 3.14159'
adb shell am broadcast \
-a org.example.app.sp.PUT \
--es key int \
--ei value 2015'
adb shell am broadcast \
-a org.example.app.sp.PUT \
--es key long \
--el value 9223372036854775807'
Restart application process after making changes
aam broadcast \
-a org.example.app.sp.CLEAR \
--ez restart true'
Open Google Camera (Pixel 4)
adb shell am start com.google.android.GoogleCamera
Set default preferences for an app:
adb shell am broadcast \
-a org.example.app.sp.CLEAR \
--es key key_name
WARNING!! This will Factory Resetet your device after next reoboot
adb shell am broadcast \
-a android.intent.action.MASTER_CLEAR
# reboot # < uncomment this for reboot your device,
# otherwise u will need to reboot manually later
# and then it will do a factory reset, you have been warned!
Open Special Menu
adb shell am start \
-a android.intent.action.VIEW \
Open settings:
am start \
-n com.android.settings/com.android.settings.Settings
Open activity to new APN
am start -a android.intent.action.INSERT \
content://telephony/carriers \
--ei simId
Open Hidden menu screen: select the entry and select "enable"
adb shell "su -c am broadcast \
-a android.provider.Telephony.SECRET_CODE \
-d android_secret_code://HIDDENMENUENABLE"
Open internal operation test menu which lets you look at all sorts of interesting and possibly dangerous goodies
adb shell "su -c am broadcast \
-a android.provider.Telephony.SECRET_CODE
-d android_secret_code://IOTHIDDENMENU"
Opens a dialog box followed by another dialog asking for the unlock key code
adb shell "su -c am broadcast \
-a android.provider.Telephony.SECRET_CODE \
-d android_secret_code://UNLOCKKERNEL"
Start prefered webbrowser (remove # for wich you wanna use)
adb shell am start \
-a android.intent.action.VIEW \
-d <url> <add any of below here>
# Default Browser: com.android.browser
# Gogle Chrome Browser: com.android.chrome
# Samsung Browser: com.sec.android.sbrowser)
Open Camera in Photo Mode
adb shell am start \
-a android.media.action.IMAGE_CAPTURE
Open Camera in Photo mode and take a picture
adb shell am start -a android.media.action.IMAGE_CAPTURE
adb shell input keyevent 66
Open Camera in Video mode
adb shell am start -a android.media.action.VIDEO_CAMERA
Open Camera in Video mode and start recording
adb shell am start -a android.media.action.VIDEO_CAMERA
input keyevent 66
Go to gallary and choose a picture and then set wallpaper:
adb shell am start -a android.intent.action.SET_WALLPAPER
Open any URL in default browser
adb shell am start \
-a android.intent.action.VIEW \
-d https://www.nr1.nu
Open Google Maps with fixed coordinates
adb shell am start -a android.intent.action.VIEW \
-d "geo:46.457398,-119.407305"
Simulate waking your app using the following commands
adb shell am set-inactive <packageName>
adb shell am set-inactive <packageName> false
Enabling Night Mode (If Supported)
adb shell am start \
--ez show_night_mode true \
com.android.systemui/.tuner.TunerActivity
Start facebook application inbox by using URI
adb shell am start \
-a android.intent.action.VIEW \
-d facebook://facebook.com/inbox
Open a vcard file from sdcard (will open contacts app)
adb shell am start \
-a android.intent.action.VIEW \
-d file:///sdcard/me.vcard \
-t text/x-vcard
Open an application to get content
adb shell am start \
-a android.intent.action.GET_CONTENT \
-t image/jpeg
There is several ways to send a SMS via AM, here is just one of several ways:
adb shell am broadcast \
-a com.whereismywifeserver.intent.TEST \
--es sms_body "test from adb"
Simulate waking your app using the following commands:
adb shell am set-inactive <packageName>
adb shell am set-inactive <packageName> false
Start facebook application inbox by using URI
adb shell am start \
-a android.intent.action.VIEW \
-d facebook://facebook.com/inbox
Open a vcard file from sdcard (will open contacts app)
adb shell am start \
-a android.intent.action.VIEW \
-d file:///sdcard/me.vcard \
-t text/x-vcard
Open an application to get content (in this case to get a jpeg picture)
adb shell am start \
-a android.intent.action.GET_CONTENT \
-t image/jpeg
There is several ways to send a SMS via AM, here is one example:
adb shell am broadcast \
-a com.whereismywifeserver.intent.TEST \
--es sms_body "test from adb"
Open settings for a specifik app
adb shell am start \
-a android.settings.APPLICATION_DETAILS_SETTINGS package:<com.package.example>
Android™ Input keyevent
Start Calculator via Keyevent
adb shell input keyevent KEYCODE_CALCULATOR
Start Calendar via Keyevent
adb shell input keyevent KEYCODE_CALENDAR
Start Call Application via Keyevent
adb shell input keyevent KEYCODE_CALL
Start Camera via Keyevent
adb shell input keyevent KEYCODE_CAMERA
Press Caps Lock via Keyevent
adb shell input keyevent KEYCODE_CAPS_LOCK
Start Captions via Keyevent
adb shell input keyevent KEYCODE_CAPTIONS
Open Contacts Application via Keyevent
adb shell input keyevent KEYCODE_CONTACTS
Copy via Keyevent
adb shell input keyevent KEYCODE_COPY
Cut via Keyevent
adb shell input keyevent KEYCODE_CUT
Delete via Keyevent
adb shell input keyevent KEYCODE_DEL
EndCall via Keyevent
adb shell input keyevent KEYCODE_ENDCALL
Press END via Keyevent
adb shell input keyevent KEYCODE_END
Jump to begin of line
adb shell input keyevent KEYCODE_DPAD_UP
Jump to end of line
adb shell input keyevent KEYCODE_DPAD_DOWN
Move cursor one step to left/righgt
adb shell input keyevent KEYCODE_DPAD_LEFT
adb shell input keyevent KEYCODE_DPAD_RIGFHT
Print -> `
adb shell input keyevent KEYCODE_GRAVE
Press Home Button
adb shell input keyevent KEYCODE_HOME
Press + and - button
adb shell input keyevent KEYCODE_MINUS
adb shell input keyevent KEYCODE_PLUS
Press + in numpad
adb shell input keyevent KEYCODE_NUMPAD_ADD
Press * button
adb shell input keyevent KEYCODE_NUMPAD_MULTIPLY
Press serach key
adb shell input keyevent KEYCODE_SEARCH
Open Settings
adb shell input keyevent KEYCODE_SETTINGS
Press # button
adb shell input keyevent KEYCODE_NUMPAD_MULTIPLY
Start default music app
adb shell input keyevent KEYCODE_POUND
Mute Volume
adb shell input keyevent KEYCODE_MUTE
Open notification bar and close
adb shell input keyevent KEYCODE_NOTIFICATION
adb shell input keyevent KEYCODE_NOTIFICATION
Cancel long press
adb shell input keyevent FLAG_CANCELED_LONG_PRESS
Open App Switch for change application
adb shell input keyevent KEYCODE_APP_SWITCH
Open Default Assistant
adb shell input keyevent KEYCODE_BRIGHTNESS_DOWN
adb shell input keyevent KEYCODE_BRIGHTNESS_UP
Select
adb shell input keyevent KEYCODE_BUTTON_SELECT
Add a Contact, fill info and press save on device
adb shell am start -a android.intent.action.INSERT \
-t vnd.android.cursor.dir/contact \
-e name 'wuseman' \
-e phone '+467777701' \
-e email '[email protected]' \
-e postal 'Street 10, New York'
For press save contact via shell from above command
adb shell input keyevent 4
adb shell input keyevent 4
adb shell am start -a android.intent.action.INSERT \
-t vnd.android.cursor.dir/contact \
-e name 'wuseman' \
-e phone '+46728999329' \
-e email '[email protected]'
#### Open dialer
```bash
adb shell am start com.samsung.android.dialer/.DialtactsActivity
Launch Launcher Activitíes
adb shell am start com.sec.android.app.launcher/com.sec.android.app.launcher.activities.LauncherActivity
Launch homescreen at first screen
adb shell am start \
com.sec.android.app.launcher/com.android.launcher3.uioverrides.QuickstepLauncher
adb shell am start \
com.sec.android.app.launcher/.activities.LauncherActivity
Launch all open apps in launcher
adb shell am start \
com.sec.android.app.launcher/com.sec.android.app.launcher.activities.LauncherActivity
Launch messenger default settings
adb shell am start \
com.samsung.android.messaging/com.samsung.android.messaging.ui.view.setting.MainSettingActivity
Launch messenger converstation composer
adb shell am start \
com.samsung.android.messaging/com.android.mms.ui.ConversationComposer
Launch messenger select contact
adb shell am start \
com.samsung.android.messaging/com.samsung.android.messaging.ui.view.recipientspicker.PickerActivity
Launch messenger with latest contacted
adb shell am start \
com.samsung.android.dialer/com.samsung.android.dialer.calllog.view.picker.CallLogPickerActivity
Launch Samsung Gallery
adb shell am start \
com.sec.android.gallery3d/com.samsung.android.gallery.app.activity.GalleryActivity
Samsung Myfiles
adb shell am start \
com.sec.android.app.myfiles/com.sec.android.app.myfiles.external.ui.MainActivity
Launs Android Settings, connections
adb shell am start com.android.settings/com.android.settings.SubSettings
Open Projectmenu (Huawei only)
adb shell am start \
com.huawei.android.projectmenu/com.huawei.android.projectmenu.ProjectMenuActivity
Make Demo Call
Establishes a fake Bluetooth connection to Dialer and must be called first to enable access to all call-related commands.
Connect to device
adb shell am broadcast -a com.android.car.dialer.intent.action.adb --es "action" "connect"
Place the outgoing call
am broadcast \
-a com.android.car.dialer.intent.action.adb \
--es "action" "addCall" \
--es "id" "4085524874"
Receive the incoming call
adb shell am broadcast \
-a com.android.car.dialer.intent.action.adb \
--es "action" "rcvCall" --es "id" "4085524874"
End the current call
adb shell am broadcast \
-a com.android.car.dialer.intent.action.adb \
--es "action" "endCall" \
--es "id" "4085524874"
Hold the current call
adb shell am broadcast \
-a com.android.car.dialer.intent.action.adb \
--es "action" "holdCall"
Unhold the current call
adb shell am broadcast \
-a com.android.car.dialer.intent.action.adb \
--es "action" "unholdCall"
Merge calls
adb shell am broadcast \
-a com.android.car.dialer.intent.action.adb \
--es "action" "unholdCall"
Clear all calls, To remove all calls in the call list:
adb shell am broadcast \
-a com.android.car.dialer.intent.action.adb \
--es "action" "clearAll"
Press home button via intent and print status info
adb shell am start \
-W -c android.intent.category.HOME \
-a android.intent.action.MAIN
Starting: Intent { act=android.intent.action.MAIN
cat=[android.intent.category.HOME] }
Warning: Activity not started, intent has been
delivered to currently running top-most instance.
Status: ok
LaunchState: UNKNOWN (0)
Activity: com.sec.android.app.launcher/com.android.launcher3.uioverrides.QuickstepLauncher
TotalTime: 0
WaitTime: 17
Complete
ADB Shell appopos
Set Application Run In Background Behavior
cmd appops set <package_name> RUN_IN_BACKGROUND ignore
Set Any Application Run In Background Behavior
cmd appops set <package_name> RUN_ANY_IN_BACKGROUND ignore
Set Application To Launch in Foreground
cmd appops set <package_name> START_FOREGROUND ignore
Set Application Settings for Instant Launch In Foreground
cmd appops set <package_name> INSTANT_APP_START_FOREGROUND ignore
Set Application Perrmision for Cliboard
cmd appops set <packagename> READ_CLIPBOARD allow
ADB Shell clipboard
- Different way to control clipboard, paste/copy mode
Paste clipboard
adb shell input kjeyevent PASTE
Paste clipboard
adb shell input keyevent 279
Paste clipboard (OLD DEVICES ONLY)
service call clipboard 1
Set Application With Read Permissions for Clipboard
adb cmd appops set com.bankid.bus READ_CLIPBOARD allow
Add Text To Clipboard
am broadcast -a clipper.set -e text "text"
ADB Shell acpi## ADB Shell acpi
Print Battery Percentage
adb shell acip
Show batteries
adb shell acip -b
Show Cooling Device State
adb shell acip -c
Show Temperatures
adb shell acip -t
Just print everything from acpi
adb shell acip -V
ADB Shell dpm
Enable Device Admin
adb shell dpm set-device-owner \
com.package.name/.DeviceAdminReceiver
ADB Shell service
StatusBar
Expand Status Bar
adb shell service call statusbar 1
Expand Status Bar
adb shell service call statusbar 2
Collapse Status Bar
adb shell service call statusbar 2
IMEI Related
Slot 1
Print IMEI - Example 1
adb shell service call iphonesubinfo 1 \
|cut -d "'" -f2 \
|grep -Eo '[0-9]'\
|xargs| sed 's/\ //g'
Print IMEI - Example 2
adb shell service call iphonesubinfo 3 i32 1 \
|grep -oE '[0-9a-f]{8} ' \
| while read hex; do
echo -ne "\u${hex:4:4}\u${hex:0:4}";
done;
echo
Print IMEI - Example 3
adb shell echo "[device.imei]: [$(service call iphonesubinfo 1 \
| awk -F "'" '{print $2}' \
| sed '1 d' \
| tr -d '\n' \
| tr -d '.' \
| tr -d ' ')]"
Print IMEI - Example 4
adb shell service call iphonesubinfo 1 \
|awk -F"'" 'NR>1 { gsub(/\./,"",$2); imei=imei $2 } END {print imei}'
Print IMEI - Example 5
adb shell service call iphonesubinfo 1 \
|cut -c 52-66 \
|tr -d '.[:space:]'"
Print IMEI - Example 6
adb shell service call iphonesubinfo 1 \
|awk -F "'" '{print }' \
|sed '1 d' \
|tr -d '.' \
|awk '{print}' ORS=
Slot 2
Some devices has 2 sim card slot, for print the second simcards imei use below:
- Print IMEI - Slot 2
adb shell service call iphonesubinfo 3 i32 2 \
|grep -oE '[0-9a-f]{8} ' \
|while read hex; do
echo -ne "\u${hex:4:4}\u${hex:0:4}";
done; echo
ADB Shell settings
List how many times we booted device:
adb shell settings list global \
|grep "boot_count=" \
|cut -d= -f2 \
|head -n 1 \
|xargs echo "Booted:" \
|sed 's/$/ times/g'
Hide Status bar
adb shell settings put global policy_control immersive.status=*
Hide Navigation bar
adb shell settings put global policy_control immersive.navigation=*
Hide both status and navigation bars
adb shell settings put global policy_control immersive.full=*
Revert bars to stock configuration
adb shell settings put global policy_control null*
It is also possible to specify this behavior for a specific application.
Examples to modify the behavior when Enterprise Browser is in the foreground:
adb shell settings put global policy_control \
immersive.full=com.honeywell.enterprisebrowser
adb shell settings put global policy_control \
immersive.navigation=com.honeywell.enterprisebrowser
adb shell settings put global policy_control \
immersive.status=com.honeywell.enterprisebrowser
ADB Shell content
Trick device that setup already has been done (FRP Bypassing)
adb shellcontent insert \
--uri content://settings/secure \
--bind name:s:user_setup_complete \
--bind value:s:1
adb shell am start \
-n com.google.android.gsf.login/
adb shell am start \
-n com.google.android.gsf.login.LoginActivity
Global/Settings/Secure
adb shell content query \
--uri content://settings/global
adb shell content query \
--uri content://settings/settings
adb shell content query \
--uri content://settings/seure
Print files for all applications
adb shell content query \
--uri content://media/external/file \
--projection _data
Query secure settings
Select "name" and value
columns from secure settings where
name
is equal to new_setting
and sort the result by name in ascending order
adb shell content query \
--uri content://settings/secure \
--projection name:value
Remove "new_setting" secure setting.
adb shell content delete \
--uri content://settings/secure \
--where "name='new_setting'"
Download current ringtone and play on PC via ffplay:
content read \
--uri content://settings/system/ringtone_cache' > a.ogg \
|xargs ffplay a.ogg
Various ways to print contacts
adb shell content query \
--uri content://contacts/phones/ \
--projection display_name:number:notes
adb shell content query \
--uri content://com.android.contacts/data \
--projection display_name:data1:data4:contact_id
adb shell content query \
--uri content://contacts/people/
Print Contacts Phone Numbers:
adb shell content query \
--uri content://contacts/phones/
Print Contacts Added In Groups:
adb shell content query \
--uri content://contacts/groups/
Print Group Mmembership:
adb shell content query \
--uri content://contacts/groupmembership/
Print organiztations:
adb shell content query \
--uri content://contacts/organizations/
Print Call Logs
adb shell content query \
--uri content://call_log/calls
Print text from SMS sections
adb shell content query \
--uri content://sms/conversations
adb shell content query \
--uri content://sms/conversations
adb shell content query \
--uri content://sms/draft
adb shell content query \
--uri content://sms/inbox
adb shell content query \
--uri content://sms/outbox
adb shell content query \
--uri content://sms/sent
Print text from MMS sections
adb shell content query \
--uri content://mms
adb shell content query \
--uri content://mms/inbox
adb shell content query \
--uri content://mms/outbox
adb shell content query \
--uri content://mms/part
adb shell content query \
--uri content://mms/sent
adb shell content query \
--uri content://mms-sms/conversations
adb shell content query \
--uri content://mms-sms/draft
adb shell content query \
--uri content://mms-sms/locked
adb shell content query \
--uri content://mms-sms/search
Auto rotation on
adb shell content insert \
--uri content://settings/system \
--bind name:s:accelerometer_rotation \
--bind value:i:1
Auto rotation off
adb shell content insert \
--uri content://settings/system \
--bind name:s:accelerometer_rotation \
--bind value:i:0
Rotate to landscape
adb shell content insert \
--uri content://settings/system \
--bind name:s:user_rotation \
--bind value:i:1
Rotate portrait
adb shell content insert \
--uri content://settings/system \
--bind name:s:user_rotation \
--bind value:i:0
ADB Shell input
Simulate a swipe down for notification bar:
adb shell input swipe 0 0 0 300
Swipe and unlock screen:
adb shell input swipe 300 1000 300 500
ADB Shell wm
Print Screen Resolution
adb shell wm size
Set Screen Size
adb shell wm size WxH
Set Overscan:
adb shell wm overscan 0,0,0,200
ADB Shell getprop
It is not so much to describe here, get info via getprop command.
- Example Usage
adb shell getprop \
|grep "model \
|version.sdk \
|manufacturer \
|hardware \
|platform \
|revision \
|serialno \
|product.name \
|brand"
Print CPU abi
adb shell getprop ro.product.cpu.abi
Get info if OEM Unlock is Allowed
1 = Enabled
0 = Disabled
adb shell getprop sys.oem_unlock_allowed
Is System boot completed
adb shell adb shell getprop sys.boot_completed
ADB Shell setprop
Auto answer any call after 2 seconds:
setprop persist.sys.tel.autoanswer.ms 2000
Turn off auto answer:
setprop persist.sys.tel.autoanswer.ms 0
ADB Shell /sys
Set Screen Brightness
Set Brightness Off
-
0 is the same as 1
echo 1 > /sys/class/backlight/panel/brightness
Set to maximum
echo 48600 > /sys/class/backlight/panel/brightness
Set to max normal
echo 255 > /sys/class/backlight/panel/brightness
Try vibrator
echo 200 > /sys/class/timed_Example Output/vibrator/enable
Print USB Mode (Charging only, MTP)
cat /sys/devices/soc0/hw_platform'
ADB Shell sm
Adopting USB-Drive
sm set-force-adoptable true
ADB Shell keytool
Genereate hash from keystore -Typically used in Facebook
keytool -exportcert -alias your_alias -keystore debug.keystore \
| openssl sha1 -binary \
| openssl base64
Typically used in Google Maps
keytool -list -v -keystore ~/.android/debug.keystore -alias your_alias
ADB Shell monkey
Test any app by pressing 10000 times at once, this will start your application and perform 10000 random events.#
monkey -p com.example.myapp -v 10000
com.google.android.youtube/.app.honeycomb.Shell$HomeActivity
com.google.android.googlequicksearchbox/.SearchActivity
com.google.android.apps.docs.editors.docs/com.google.android.apps.docs.app.NewMainProxyActivity
com.android.documentsui/.LauncherActivity
com.google.android.apps.docs.editors.sheets/com.google.android.apps.docs.app.NewMainProxyActivity
com.google.android.apps.docs.editors.slides/com.google.android.apps.docs.app.NewMainProxyActivity
com.android.vending/.AssetBrowserActivity
ADB Shell sqlite3
All previous commands is stored in
/data/user_de/0/com.android.providers.telephony/Log/FileLog0.log
06-06 18:17:04.084 TP/MSP(27290): u:content://mms-sms/selected-conversations?type=all&multipleThreadIds=0, caller:com.samsung.android.messaging
06-06 18:17:08.209 TP/MSP(27290): u:content://mms-sms/selected-conversations?type=all&multipleThreadIds=0, caller:com.samsung.android.messaging
06-07 10:32:17.684 TP/MSP(4617) : u:content://mms-sms/selected-conversations?type=all&multipleThreadIds=0, caller:com.samsung.android.messaging
06-20 16:22:00.555 TP/MSP(8855) : u:content://mms-sms/selected-conversations?type=all&multipleThreadIds=0, caller:com.samsung.android.messaging
07-04 11:39:09.070 TP/BinSms(27174): move() - delete duplicated sms : 0
07-04 11:39:09.103 TP/BinIm(27174): move() - delete duplicated im : 0
07-04 12:04:09.178 TP/BinIm(5264): move() - delete duplicated im : 0
07-04 12:38:35.577 TP/IP(20576) : u:content://im/chat/72, r:1, caller:com.samsung.android.messaging
07-04 13:46:43.746 TP/IP(29004) : u:content://im/chat/77, r:1, caller:com.samsung.android.messaging
07-04 13:57:14.609 TP/IP(29004) : u:content://im/chat/83, r:1, caller:com.samsung.android.messaging
08-16 07:20:44.451 TP/BnR(30184): FILE all backup finished
08-17 07:56:18.262 TP/MSP(9363) : u:content://mms-sms/selected-conversations?type=all&multipleThreadIds=32&multipleThreadIds=24, r:30, caller:com.samsung.android.messaging
Carrier info
cat /data/user_de/0/com.android.providers.telephony/files/carrierconfig-com.android
Read Lock Settings:
sqlite3 -line /data/user_de/0/com.android.providers.telephony/databases/telephony.db 'select * from locksettings;'
Read SIM Card info
sqlite3 -line /data/user_de/0/com.android.providers.telephony/databases/telephony.db 'select * from android_metadata'
sqlite3 -line /data/user_de/0/com.android.providers.telephony/databases/telephony.db 'select * from carrier'
sqlite3 -line /data/user_de/0/com.android.providers.telephony/databases/telephony.db 'select * from original'
sqlite3 -line /data/user_de/0/com.android.providers.telephony/databases/telephony.db 'select * * from siminfo'
icc_id = 8946209802SSSSSSSSS
card_id = 8946209802SSSSSSSSS
display_name = CARD
mcc = 0
mnc = 0
icc_id = 8946209802SSSSSSSSS
card_id = 8946209802SSSSSSSSS
carrier_name = Telia
display_name = Telia
mcc = 240
mnc = 7
Print ICCID
sqlite3 /data/vendor/radio/qcril.db 'select ICCID from qcril_manual_prov_table'
Print Carrier Name, ICC ID, MCC, Card ID and everything that is stored from sim:
sqlite3 -line /data/user_de/0/com.android.providers.telephony/databases/telephony.db 'select * from siminfo'
_id = 1
icc_id = xxxxxxxxxxxxxxxxxxxx
sim_id = 1
display_name = Comviq
carrier_name = Comviq
name_source = 3
color = -XXXXXX
number =
display_number_format = 1
data_roaming = 1
mcc = 240
mnc = 7
mcc_string = 240
mnc_string = 07
ehplmns = 24xxx,24xxx,24xxx
hplmns = 24xxx,24xxx,24xxx,24xxx
sim_provisioning_status = 0
is_embedded = 1
card_id = xxxxxxxxxxxxxxxxxxxx
access_rules =
access_rules_from_carrier_configs =
is_removable = 0
enable_cmas_extreme_threat_alerts = 1
enable_cmas_severe_threat_alerts = 1
enable_cmas_amber_alerts = 1
enable_emergency_alerts = 1
alert_sound_duration = 4
alert_reminder_interval = 0
enable_alert_vibrate = 1
enable_alert_speech = 1
enable_etws_test_alerts = 0
enable_channel_50_alerts = 1
enable_cmas_test_alerts = 0
show_cmas_opt_out_dialog = 1
volte_vt_enabled = 1
vt_ims_enabled = 1
wfc_ims_enabled = 1
wfc_ims_mode = 1
wfc_ims_roaming_mode = -1
wfc_ims_roaming_enabled = -1
is_opportunistic = 0
group_uuid =
is_metered = 1
iso_country_code = se
carrier_id = 1696
profile_class = 2
subscription_type = 0
group_owner =
data_enabled_override_rules =
imsi = xxxxxxxxxxxxxxxx
uicc_applications_enabled = 1
allowed_network_types = -1
ims_rcs_uce_enabled = 0
cross_sim_calling_enabled = 0
rcs_config =
allowed_network_types_for_reasons = user=xxxxxxx
voims_opt_in_status = 0
d2d_sharing_status = 0
d2d_sharing_contacts =
Print data in .db files, clean:
grep -vx -f <(sqlite3 Main.db .dump) <(sqlite3 ${DB} .schema)
Use below command fr update dg.db file:
sqlite3 /data/data/com.google.android.gms/databases/dg.db "update main set c='0' where a like '%attest%';"
Grab all file extensions of a kind and download to PC
for i in `"su -c find /data /system -name '*.key'"`; do
mkdir -p ".`dirname $i`";"su -c cat $i" > ".$i";
done
Print uptime for your device by days + time
TZ=UTC date -d@$(cut -d\ -f1 /proc/uptime) +'%j %T' \
|awk '{print $1-1"d",$2}'
Android paths
/data/ssh
/data/adb/magisk
/data/data/<package>/databases (app databases)
/data/data/<package>/shared_prefs/ (shared preferences)
/data/app (apk installed by user)
/system/app (pre-installed APK files)
/mmt/asec (encrypted apps) (App2SD)
/mmt/emmc (internal SD Card)
/mmt/adcard (external/Internal SD Card)
/mmt/adcard/external_sd (external SD Card)
Android root
Commands for rooted devices
Find out if the device is rooted and if su exist
which su &> /dev/null
if [[ $? = "0" ]]; then
echo "Device Rooted:
else
echo "Device Rooted: No"
fi
Bypass Google Pay Block for Rooted Devices
adb shell am force-stop \
/data/data/com.google.android.apps.walletnfcrel
## Hide root for Google applications:
for google_apps in $(cmd package list packages|grep -i com.google |cut -d: -f2); do
magiskhide add ${google_apps};
done
## Change permissions on dg.db to read-and-write:
su sh -c chmod 0777 /data/data/com.google.android.gms/databases/dg.db
# Now change permissions on dg.db to 0444
chmod 0444 /data/data/com.google.android.gms/databases/dg.db
Grab all file extensions of a kind and pull them all to your pc
for i in `"su -c find /data /system -name '*.key'"`; do
mkdir -p ".`dirname $i`";"su -c cat $i" > ".$i";
done
Android wuseman's notices
Find out happens when we remove below file
rm /data/misc/bootstat/boot_complete?
Android magisk (updated version - zygisk - comming soon)
..... will be added very soon.
Android magisk (older versions)
Enable magiskhide
/sbin/magisk magiskhide enable
List hided apps by magisk
/sbin/magisk magiskhide list
Add package to magiskhide
/sbin/magisk magiskhide add com.package
ADB Shell commands sorted by brand
Samsung
Bypass Samsung Health block on rooted samsung devices (Old Method, wont work on latest updates from samsung health)
mount -o rw,remount /system/etc/mkshrc
sed -i 's/ro.config.tima=1/ro.config.tima=0/g' build.prop
If you can't use smart view 2 to stream your screen to other devices, use below trick:
mount -o rw,remount /
printf '%s\n' \
# Fix for smartview on rooted devices, android 12" \
wlan.wfd.hdcp=disable" >> /system/build.prop
reboot
ADB Shell screencap
adb shell screencap /storage/emulated/0/Pictures/screenshot.png
ADB Shell screenrecord
adb shell screenrecord --time-limit 10 /storage/emulated/0/Video/record.mp4
Android FRP BYpass by wuseman
- wuseman - Samsung Galaxy A10
- wuseman - Samsung Galaxy A10
- wuseman - Samsung Galaxy A5
- wuseman - Samsung Galaxy S10
- wuseman - Samsung Galaxy S8
- wuseman - Samsung Galaxy Xcover 4
- wuseman - Motorola Moto E4 Plus
- wuseman - Huawei MediaTab T5
- wuseman - LG G6
Awesome Resources for ADB
For Working with Android devices via commandline
Gentoo Wiki
ADB Shell
- Android™ Developer - Emulator Console
- Android™ Developer - Write your app
- Android™ Google Source - Source Code
- Android™ Google Source - CMD Command
- Android™ Generic Project
- Android™ GDB
- Android™ Source - Understand Logging
- Android™ Source - Network Connectivity Tests
- Android™ Platform Tools
- Github Randorise - Mobile Hacking CheatSheet
- Mazhuang - Awesome ADB - Another Cheatsheet Wiki
- Jfsso - Preferences Editor
- Nahamsec - Resources For Beginner - Bug Bounty Hunters
- Raywenderlich -Forensic Artifacts
- Noobsec - Bypass Fingerprint Lock In Just 1 Second
- Noobsec - Cara Reverse Engineering
- Oracle- JVMS
- Tjtech - Analyze OEM Unlocking Under Android
- U'Smile - How to change the IMEI on Android devices
- Android™ Q Navigation - Gesture Controls
Wiki author
- wuseman [email protected]
Wiki License
Android Nr1 nu wiki is licensed under the GNU General Public License v3.0 - See the LICENSE.md file for details
- Glad you made it until the end of this README, I hope you found something useful here and
- now you have taken a step closer to becoming a master in working with androdi debug shell via commandline
// wuseman