Created
October 3, 2014 13:47
-
-
Save FokkeZB/86713457bf84808a12a6 to your computer and use it in GitHub Desktop.
Alias for making screenshots from connected Android device/emulator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias screenshot='adb shell screencap -p | perl -pe "s/\x0D\x0A/\x0A/g" > "/Users/fokkezb/Downloads/android_$(date +%Y%m%d-%H%M%S).png"' | |
# NOTE: Replace 'fokkezb' with your user. You cannot use ~ when using $() unfortunately |
I know this is an old gist, but still handy. Here's a better way to do this without hard-coding the path to your user's directory:
# take a screencap of a connected Android device
alias screenshot='adb shell screencap -p | perl -pe "s/\x0D\x0A/\x0A/g" > "$HOME/Desktop/android_$(date +%Y%m%d-%H%M%S).png"'
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Stating the obvious, you can save to the desktop rather than downloads with:
adb shell screencap -p | perl -pe "s/\x0D\x0A/\x0A/g" > "/Users/YOURUSERNAME/Desktop/android_$(date +%Y%m%d-%H%M%S).png"