So regardless of being a failure at pretty much everything, I still like to tinker and tweak my android phones pretty regularly, and one thing I rather hate is the need to open DDMS/Monitor to take a screenshot.
Well, a few days ago I found a great tip on this site: http://blog.shvetsov.com/2013/02/grab-android-screenshot-to-computer-via.html
And quickly decided to expand on it a bit for my own personal use, and thought I’d share my final implementation here in case anyone might use it.
Just add the following function to your .bashrc or .zshrc file and either re-start your shell, or re-source the file (e.g. source $HOME/.zshrc) to be able to use the “adbss” command.
# setup a simple adb screenshot function adbss () { local file="$(/bin/date +"%d-%b-%Y_%I.%M.%S").png" local dir="$HOME/Downloads/adb_screencaps" if [[ ! -d $dir ]]; then mkdir -p "${dir}" fi adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > "$dir/$file" }
And of course to change the directory the screencaps are stored in, just edit the “local dir=…” line with the path to the directory of your choosing.
Anyway, I’ve tested this with the default BASH 3.2.48 shipped with OS X 10.8, BASH 4.2.52 (built by homebrew), and ZSH 5.0.2 (also built by homebrew) and it works fine in all three.