Time flies, it's about time to get up new commands for our Android devices since there is really much stuff that is being added,updated and removed for our devices, I havent seen all those new commands anywere so hopefully this will be useful for you guys aswell.
Feel free to contribute to this repo if there is something that i forgot and is worth to know, however, let me show you what's new.
I decided to not add 'adb shell ' wich means all commands is executed when we are connected to device but of course if you want to, just add 'adb shell' infront of all commands and it will work aswell without being connected to the device shell
All commands that require root will have (Root_Required) in descriptionn.
Links works when you clicking the links with your mobile device, please visit android.nr1.nu to get clickable links.
- Click to Erase Lock Settings (dont press unless you frp unlocking)
- Click to Open My Files
- Google Search App
- Samsung Apps
- Alliance Shield X (Galaxy Store)
- Download SDK Platform-Tools for Linux
- Download SDK Platform-Tools for MacOSX
- Download SDK Platform-Tools for Windows
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.
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.
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).
pacman -S android-tools
emerge --ask dev-util/android-sdk-update-manager
dnf install adb
apt install adb fastboot -y
/data/user_de/0/com.android.providers.telephony/databases/mmssms.db
/data/user_de/0/com.android.providers.telephony/databases/telephony.db
/system/media/audio/ui/
/system/media/audio/ringtones
/system/media/audio/notifications
adb start-server
adb stop-server
adb kill-server
adb tcpip <port>
adb connect <device_ip>
adb usb
adb devices
adb get-state
adb get-serialno
adb backup -all
adb restore /path/to/backupflile.adb
adb shell
adb -s <id_from_adb_devices> shell
adb get-serialno
adb bugreport
adb install <apk_file>
adb install -r <apk_file>
adb uninstall <apk_file>
adb push = tansfer a file: pc > device
adb push mypicture.png /storage/on/device
adb push myfolder /storage/on/device
adb pull = tansfer a file: device > pc
adb pull /storage/on/device/mypicture.png /path/on/pc
adb pull /storage/on/device /path/on/pc
- Script for pull all installed Apks
- Script for pull all installed system Apks
- Script for pull all Apks installed by you
adb pull /storage/on/device/ /path/on/pc # Notice the trial slash
Stream Device Screen on your PC
Does anyone know how to to view AND record the stream at same time? Let me know!
Exec Out Syntax
adb exec-out screenrecord --Example Output-format=h264 - | prefered tool - <stdin>
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.
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 -
Adding --clock-jitter=0 seems to make the errors less traumatic, but it's still pretty messed up vlc is not recommended for this, use FFplay or Mplayer if possible
Stream via VLC on Windows
adb exec-out screenrecord --bit-rate=4m --Example Output-format=h264 --size 800x600 --show-frame-time - \
|"c:\Program Files\VideoLAN\VLC\vlc" --demux h264 - vlc://quit
Record your device screen via VLC on Windows
adb exec-out screenrecord --bit-rate=4m --Example Output-format=h264 --size 800x600 --show-frame-time - \
|"c:\Program Files\VideoLAN\VLC\vlc" --demux h264 --sout file/ts:c:\temp\screenrec.mpg - vlc://quit
Sniff your device network and SMS traffic via Wireshark on your PC
adb exec-out "tcpdump -i any -U -w - 2>/dev/null" | wireshark -k -S -i -
adb reboot
adb reboot recovery
adb reboot bootloader
adb reboot fastboot
date MMDDYYYY.XX;am broadcast -a android.intent.action.TIME_SET
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 Verifi D7AE er 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.
-
*Prints the malloc debug information. You need to run the following first:
adb shell stop adb shell setprop libc.debug.malloc.program statsd adb shell setprop libc.debug.malloc.options backtrace adb shell start cmd stats print-stats
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
cmd stats write-to-disk
cmd stats print-uid-map
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.
cmd statusbar send-disable-flag notification-icons
cmd statusbar send-disable-flag none
cmd statusbar get-status-icons
cmd statusbar prefs list-prefs
cmd statusbar expand-notifications
cmd statusbar collapse
cmd statusbar expand-settings
cmd statusbar help
cmd user list
cmd uimode night yes
cmd uimode night no
cmd uimode car yes
cmd uimode car no
cmd -w wifi start-scan
sleep 7
cmd -w wifi list-scan-results
Equivalent to receiving the TelephonyManager.ACTION_EMERGENCY_CALL_STATE_CHANGED
broadcast.
cmd -w wifi set-emergency-call-state enabled|disabled
cmd -w wifi set-emergency-callback-mode enabled|disabled
cmd -w wifi list-suggestions-from-app <package name>
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.
cmd -w wifi network-requests-has-user-approved <package name>
Sets whether network requests from the app is approved or not.
cmd -w wifi network-requests-set-user-approved <package name> yes|no
cmd -w wifi list-requests
cmd -w wifi remove-all-requests
cmd -w wifi remove-request <ssid>
cmd -w wifi add-request <ssid> open|owe|wpa2|wpa3 [<passphrase>] [-b <bssid>]
cmd -w wifi settings-reset
cmd -w wifi get-softap-supported-features
cmd -w wifi get-wifi-watchdog
cmd -w wifi set-wifi-watchdog enabled|disabled
cmd -w wifi force-country-code enabled <two-letter code> | disabled
cmd -w wifi send-link-probe
cmd -w wifi clear-user-disabled-networks
cmd -w wifi network-requests-remove-user-approved-access-points <package name>
cmd -w wifi imsi-protection-exemption-clear-user-approved-for-carrier <carrier id>
cmd -w wifi imsi-protection-exemption-has-user-approved-for-carrier <carrier id>
cmd -w wifi imsi-protection-exemption-set-user-approved-for-carrier <carrier id> yes|no
cmd -w wifi network-suggestions-has-user-approved <package name>
cmd -w wifi network-suggestions-set-user-approved <package name> yes|no
cmd -w wifi force-low-latency-mode enabled|disabled
cmd -w wifi force-hi-perf-mode enabled|disabled
cmd -w wifi get-poll-rssi-interval-msecs
cmd -w wifi set-poll-rssi-interval-msecs <int>
Equivalent to receiving the TelephonyManager.ACTION_EMERGENCY_CALL_STATE_CHANGED
broadcast,
sets whether we are in the middle of an emergency call.
cmd -w wifi set-emergency-call-state enabled|disabled
cmd -w wifi set-emergency-callback-mode enabled|disabled
cmd -w wifi list-suggestions-from-app <package name>
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
cmd -w wifi network-requests-has-user-approved <package name>
Sets whether network requests from the app is approved or not.
cmd -w wifi network-requests-set-user-approved <package name> yes|no
cmd -w wifi list-requests
cmd -w wifi remove-all-requests
cmd -w wifi remove-request <ssid>
cmd -w wifi add-request <ssid> open|owe|wpa2|wpa3 [<passphrase>] [-b <bssid>]
cmd -w wifi settings-reset
cmd -w wifi get-softap-supported-features
cmd -w wifi get-wifi-watchdog
cmd -w wifi set-wifi-watchdog enabled|disabled
cmd -w wifi force-country-code enabled <two-letter code> | disabled
cmd -w wifi force-softap-channel enabled <int> | disabled
cmd -w wifi send-link-probe
cmd -w wifi clear-user-disabled-networks
cmd -w wifi network-requests-remove-user-approved-access-points <package name>
cmd -w wifi imsi-protection-exemption-clear-user-approved-for-carrier <carrier id>
cmd -w wifi imsi-protection-exemption-has-user-approved-for-carrier <carrier id>
cmd -w wifi imsi-protection-exemption-set-user-approved-for-carrier <carrier id> yes|no
cmd package list packages -U####
cmd package list packages -l
cmd package list packages -d
cmd package list packages -e
cmd package list packages -3
cmd package set-home-activity [--user USER_ID] TARGET-COMPONENT
cmd package list features
cmd package resolve-activity --brief com.facebook.katana
priority=0 preferredOrder=0 match=0x108000 specificIndex=-1 isDefault=false
com.facebook.katana/.LoginActivity
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
pm list packages
pm list packages -e
pm list packages -d
pm list packages -3
pm list users
pm list permission-groups
pm list features
pm uninstall --user 0 com.package.name
for packages in com.package1 com.package2; do
adb shell pm uninstall --user 0 "${packages}"
done
pm clear PACKAGE_NAME
pm list permission-groups
pm list instrumentation
pm grant com.application android.permission.READ_LOGS
pm revoke com.application android.permission.READ_LOGS
pm reset-permissions -p your.app.package
Example Output
* 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)
adb logcat -v time ...
adb logcat -v threadtime ....
adb logcat ... -v color
adb logcat -g
adb logcat -G 16M
adb logcat -c
adb logcat *:V
adb logcat -f <filename> Dumps to specified file
adb logcat -v process
adb logcat -v raw
adb logcat -v time
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
adb logcat -v long
adb logcat -b main -b radio -b events
adb logcat -v brief -v long -v process -v raw -v tag -v thread -v threadtime -v time -v color
dumpsys -l
List services on older devices via command below
dumpsys -l |sed 's/^ / /g'
Example Output
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
Example Output
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
dumpsys media.audio_flinger | grep -A3 Input
dumpsys bluetooth_manager
dumpsys telephony.registry
dumpsys location
adb shell dumpsys settings
Example Output
_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
adb shell dumpsys simphonebook
adb shell dumpsys hardware_properties
Example Output
****** Dump of HardwarePropertiesManagerService ******
CPU temperatures: [38.0, 38.0]
CPU throttling temperatures: [55.0, 76.0]
CPU shutdown temperatures: [115.0, 115.0]
dumpsys account|grep -i com.*$ -o|cut -d' ' -f1|cut -d} -f1|grep -v com$
Example Output
com.microsoft.workaccount
com.skype.raider
com.samsung.android.mobileservice
com.facebook.messenger
com.google.android.gm.exchange
dumpsys notification
dumpsys | grep -E -o "\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b"
dumpsys package com.lge.signboard | grep versionName
versionName=6.00.170603-0
adb shell dumpsys user
Example Output
State: RUNNING_UNLOCKED
Last logged in fingerprint
agree Knox Privacy Policy: false
adb shell dumpsys battery
adb shell dumpsys batterystats
dumpsys batterystats --reset
dumpsys meminfo
Example Output
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: android.hardware.graphics.composer@2.1-service (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
dumpsys battery unplug
dumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp'|grep '/'|awk -F'u0' '{print $2}'|awk '{print $1}'
dumpsys notification | grep NotificationRecord | wc -l
dumpstate -v
Example Output
========================================================
== 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=
settings put global sysui_demo_allowed 1
am broadcast -a com.android.systemui.demo -e command clock -e hhmm 1200
am broadcast -a com.android.systemui.demo -e command network -e mobile show -e level 4 -e datatype false
am broadcast -a com.android.systemui.demo -e command notifications -e visible false
am broadcast -a com.android.systemui.demo -e command battery -e plugged false -e level 100
am broadcast -a com.android.systemui.demo -e command exit
adb shell 'am broadcast -a org.example.app.sp.PUT --es key key_name --es value "hello world!"'
adb shell 'am broadcast -a org.example.app.sp.REMOVE --es key key_name'
adb shell 'am broadcast -a org.example.app.sp.CLEAR --es key key_name'
adb shell 'am broadcast -a org.example.app.sp.PUT --es name Game --es key level --ei value 10'