Skip to content

Instantly share code, notes, and snippets.

@sidferreira
Created January 2, 2026 17:38
Show Gist options
  • Select an option

  • Save sidferreira/2b9b2cef2e6d17e13d8678acf0c1ca82 to your computer and use it in GitHub Desktop.

Select an option

Save sidferreira/2b9b2cef2e6d17e13d8678acf0c1ca82 to your computer and use it in GitHub Desktop.
ADB ScreenShot
#!/bin/bash
# Generate filename with timestamp
filename="Android Screenshot $(date +"%Y-%m-%d at %I.%M.%S %p").png"
desktop_path="$HOME/Desktop/$filename"
# Take screenshot using adb and save to Desktop
adb exec-out screencap -p > "$desktop_path"
# Check if the screenshot was successful
if [ $? -eq 0 ]; then
echo "Screenshot saved to: $desktop_path"
else
echo "Failed to take screenshot. Make sure your Android device is connected."
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment