Skip to content

Instantly share code, notes, and snippets.

@aminone
Last active September 14, 2024 13:57
Show Gist options
  • Save aminone/2b1d197f55cfffe6a50ff3a1f8603220 to your computer and use it in GitHub Desktop.
Save aminone/2b1d197f55cfffe6a50ff3a1f8603220 to your computer and use it in GitHub Desktop.
A collection of Android Debug Bridge (ADB) commands
# To get file
adb pull <PATH/TO/FILE/ON/DEVICE>
# To push file
adb push <PATH/TO/FILE> <PATH/TO/DESTINATION>
# To get wifi MAC address
adb shell cat /sys/class/net/wlan0/address
# To get IP Address
adb shell netcfg
# To connect over wifi address
adb tcpip [PORT]
adb connect [IP:PORT]
# To reboot device
adb reboot
# To shutdown device
adb shell reboot -p
# To set timezone
adb shell setprop persist.sys.timezone "Asia/Tehran"
# To get timezone
adb shell getprop persist.sys.timezone
# To get all prop
adb shell getprop
# To take a screenshot of a device display.
adb shell screencap /sdcard/screen.png
# Recording the display of devices running Android 4.4 (API level 19) and higher.
adb shell screenrecord /sdcard/demo.mp4
adb shell screenrecord --size <WIDTHxHEIGHT>
adb shell screenrecord --bit-rate <RATE>
adb shell screenrecord --time-limit <TIME> #Time in seconds, max=180
adb shell screenrecord --rotate #Rotates the output 90 degrees. This feature is experimental.
adb shell screenrecord --verbose
# To change screen size (on nexus 10 for example)
adb shell wm size 1280x800 or whatever size or reset
#then
adb shell wm density 480 or whatever density or reset
### Logcat
# lowest priority, filter to only show Verbose level
adb logcat *:V
# filter to only show Debug level
adb logcat *:D
# filter to only show Info level
adb logcat *:I
# filter to only show Warning level
adb logcat *:W
# filter to only show Error level
adb logcat *:E
# filter to only show Fatal level
adb logcat *:F
# Silent, highest priority, on which nothing is ever printed
adb logcat *:S
## adb logcat -b <Buffer>
# default
adb logcat -b main
# View the buffer that contains radio/telephony related messages.
adb logcat -b radio
# View the buffer containing events-related messages.
adb logcat -b event
# Clears the entire log and exits.
adb logcat -c
# Dumps the log to the screen and exits.
adb logcat -d
# Writes log message output to test.logs.
adb logcat -f test.logs
# Prints the size of the specified log buffer and exits.
adb logcat -g
# Sets the maximum number of rotated logs to <count>. Notes: The default value is 4. Requires the -r option.
adb logcat -n <count>
# Rotates the log file every <kbytes> of output. Notes: The default value is 16. Requires the -f option.
adb logcat -r <kbytes>
#Sets the default filter spec to silent.
adb logcat -s
##adb logcat -v <format>
# Display priority/tag and PID of the process issuing the message (default format).
adb logcat -v brief
# Display PID only.
adb logcat -v process
# Display the priority/tag only.
adb logcat -v tag
# Display the raw log message, with no other metadata fields.
adb logcat -v raw
# the date, invocation time, priority/tag, and PID of the process issuing the message.
adb logcat -v time Display
# 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
@Abhishek-Sharma21
Copy link

Hi mate, what would be the trick if I've to start one in 247 time format and not the locale.
trying to automatically start an emulator with 24
7 format and potentially wanted to add it within startup scripts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment