Complete toolkit for managing and controlling your Android phone from your computer.
- Model: Google Pixel 7a
- Android Version: 16
- Serial: 2C161JEHN07969
- IP Address: 192.168.1.13
# Add to PATH for easy access
export PATH="$HOME/LAB/projects/phone-ops/bin:$PATH"
# Launch phone control (scrcpy)
phone-control
# Get phone information
phone-info
# Take a screenshot
phone-screenshot
# Transfer files
phone-transfer pull /sdcard/DCIM/Camera/photo.jpg
phone-transfer push ~/file.pdf /sdcard/Download/
# Backup phone data
phone-backupphone-ops/
├── bin/ # Executable scripts
│ ├── phone-connect # Connection manager
│ ├── phone-setup-wifi # WiFi setup helper
│ ├── phone-control # Launch scrcpy
│ ├── phone-info # Device information
│ ├── phone-screenshot # Capture screenshots
│ ├── phone-transfer # File transfer utility
│ ├── phone-backup # Backup utility
│ ├── phone-organize # File organization & cleanup
│ ├── phone-automate # UI automation & flows
│ ├── phone-record # Screen recording
│ ├── phone-input # Text/key injection
│ ├── phone-monitor # System monitoring
│ ├── phone-apps # App management
│ ├── phone-test # Automated testing
│ └── phone-security-scan # Security analysis
├── backups/ # Phone backups (timestamped)
├── screenshots/ # Screenshots & recordings
├── files/ # Downloaded files
├── logs/ # Operation logs
├── data/ # General data storage
│ ├── apk-backups/ # APK backups
│ ├── test-results/ # Test outputs
│ ├── organization/ # File organization data
│ └── security-audit/ # Security scan results
├── phone-config.env # Phone configuration
├── README.md # This file
├── QUICK-REFERENCE.md # Quick command reference
├── SCRCPY-REFERENCE.md # Complete scrcpy shortcuts
├── ADB-REFERENCE.md # Complete ADB commands
├── AUTOMATION-COOKBOOK.md # Automation recipes
├── OPTIMIZATION-GUIDE.md # Performance & battery optimization
└── ORGANIZATION-GUIDE.md # File organization & cleanup
phone-connect [wifi|usb|auto]
- Manages connection to your phone
- Auto-detects and connects via preferred method
- Usage:
phone-connect wifi # Connect via WiFi phone-connect usb # Connect via USB phone-connect auto # Auto-detect (default)
phone-setup-wifi
- One-time WiFi setup (requires USB initially)
- Enables wireless ADB connection
- Updates configuration file with phone IP
- Usage:
# Connect phone via USB first phone-setup-wifi # Now you can unplug USB cable
phone-control [scrcpy-options]
- Launches scrcpy with automatic device selection
- Supports all scrcpy command-line options
- Usage:
phone-control # Basic launch phone-control --turn-screen-off # Launch with screen off phone-control --max-size 1920 # Limit resolution
Scrcpy Keyboard Shortcuts:
Ctrl+s- Switch phone screen offCtrl+o- Turn phone screen onCtrl+r- Rotate screenCtrl+n- Expand notificationsCtrl+h- Home buttonCtrl+b- Back buttonCtrl+f- Fullscreen toggle
phone-info
- Displays comprehensive device information
- Shows battery status, storage, network, display specs
- Usage:
phone-info
phone-screenshot
- Captures screenshot and saves locally
- Auto-generates timestamped filename
- Saves to
screenshots/directory - Usage:
phone-screenshot # Returns: /home/miko/LAB/projects/phone-ops/screenshots/screenshot_20251002_131500.png
phone-transfer <command> [args]
- Bidirectional file transfer
- APK installation
- Usage:
# Send file to phone phone-transfer push ~/document.pdf /sdcard/Download/ # Get file from phone phone-transfer pull /sdcard/DCIM/Camera/IMG_1234.jpg phone-transfer pull /sdcard/DCIM/Camera/IMG_1234.jpg ~/Pictures/ # Install APK phone-transfer install ~/Downloads/app.apk
phone-organize <command> [options]
- Automated file organization and cleanup
- Commands: scan, by-type, by-date, find-duplicates, remove-duplicates, disk-usage, clean-empty, all
- Organizes Downloads, Documents, Pictures (excludes camera roll)
- Usage:
# Analyze current file distribution phone-organize scan # Organize files by type (PDF → Documents, MP3 → Music, etc.) phone-organize by-type --dry-run # Preview first phone-organize by-type # Apply # Organize Downloads by date (YYYY/MM folders) phone-organize by-date # Find duplicate files (size + MD5 hash) phone-organize find-duplicates # Show disk usage by folder phone-organize disk-usage # Remove empty directories phone-organize clean-empty # Full workflow (scan → organize → duplicates → cleanup) phone-organize all --dry-run
File Type Categories:
- Documents: PDF, DOC, DOCX, TXT, EPUB, XLS, PPT
- Pictures: JPG, PNG, GIF, WEBP (downloaded/screenshots only)
- Music: MP3, M4A, FLAC, WAV, AAC
- Movies: MP4, MKV, AVI, MOV, WEBM
- Archives: ZIP, RAR, 7Z, APK, JAR
- Code: JAVA, PY, JS, HTML, CSS, JSON
Note: Camera photos (/sdcard/DCIM/Camera/) are never touched.
phone-backup
- Creates timestamped backup of phone data
- Backs up: Photos (DCIM), Downloads, Pictures
- Saves installed apps list
- Saves device information
- Usage:
phone-backup # Creates: backups/20251002_131500/
phone-automate <command>
- UI automation and flow execution
- Commands: tap, swipe, type, key, launch, flow
- Usage:
phone-automate tap 540 960 phone-automate type "Hello World" phone-automate swipe up phone-automate flow ~/automation/login.txt
phone-record [options] [filename]
- Enhanced screen recording with quality options
- Options: --time, --bitrate, --size
- Usage:
phone-record demo.mp4 phone-record --time 30 --bitrate 8M hq-demo.mp4
phone-input <command>
- Text injection and key event simulation
- Commands: text, key, tap, swipe, longpress
- Usage:
phone-input text "Hello World" phone-input key enter phone-input swipe up
phone-monitor <command>
- Real-time system monitoring
- Commands: battery, cpu, memory, network, app, logs, all
- Usage:
phone-monitor battery phone-monitor app com.example.app phone-monitor all --interval 2
phone-apps <command>
- Comprehensive app management
- Commands: list, info, install, batch-install, backup, backup-all, launch, stop, clear
- Usage:
phone-apps list 3rd phone-apps info com.android.chrome phone-apps batch-install ~/Downloads/apps/ phone-apps backup-all
phone-test <command>
- Automated UI testing
- Commands: monkey, launch-test, ui-test, screenshot-compare, stress
- Usage:
phone-test monkey com.example.app 1000 phone-test launch-test com.example.app 10 phone-test stress com.example.app 300
phone-optimize <profile>
- Apply optimization profiles for performance or battery life
- Profiles: performance, battery, balanced, gaming, restore
- Commands: status, cache-clear, bloat-list, monitor
- Usage:
phone-optimize performance # Maximum speed phone-optimize battery # Maximum battery life phone-optimize balanced # Best of both phone-optimize gaming # Gaming optimized phone-optimize status # Show current settings phone-optimize cache-clear # Free up space phone-optimize --dry-run battery # Preview changes
Edit phone-config.env to customize settings:
PHONE_MODEL="Pixel 7a"
PHONE_MANUFACTURER="Google"
PHONE_ANDROID_VERSION="16"
PHONE_IP="192.168.1.13"
PHONE_PORT="5555"
PHONE_SERIAL="2C161JEHN07969"
PHONE_CONNECTION_TYPE="wifi" # wifi or usb- ADB (Android Debug Bridge) -
sudo dnf install android-tools - scrcpy -
sudo dnf install scrcpy - Android phone with Developer Options enabled
On your phone:
- Go to Settings → About phone
- Tap Build number 7 times
- Go back to Settings → Developer Options
- Enable USB debugging
# 1. Connect phone via USB
# 2. Accept USB debugging prompt on phone
# 3. Run WiFi setup
phone-setup-wifi
# 4. Unplug USB cable
# 5. Test connection
phone-connect wifi
phone-control# Check USB connection
adb devices
# Restart ADB server
adb kill-server
adb start-server
adb devices# Reconnect
phone-connect wifi
# Or setup again with USB
phone-setup-wifiIf your phone gets a new IP:
# Connect via USB temporarily
phone-connect usb
# Get new IP
adb shell ip route | grep -oP 'src \K[\d.]+'
# Update phone-config.env manually or run:
phone-setup-wifi# High quality, lower latency
phone-control --bit-rate 8M --max-fps 60
# Portrait mode, smaller window
phone-control --max-size 1080 --rotation 0
# Audio forwarding (scrcpy 2.0+)
phone-control --audio-source=playback
# Record screen to file
phone-control --record=recording.mp4# Daily backup script
#!/bin/bash
phone-connect wifi && phone-backup
# Screenshot every 5 seconds
#!/bin/bash
while true; do
phone-screenshot
sleep 5
done
# Monitor battery
#!/bin/bash
watch -n 60 'phone-info | grep -A3 "Battery Status"'This project integrates with the broader LAB workspace:
- MCP Servers: Can use
cloudflare-containerto run Android automation scripts - Jupyter Notebooks: Analyze phone data exports
- Perplexity: Research Android automation techniques
- USB debugging grants significant device access
- Only connect to trusted computers
- Disable USB debugging when not needed
- Use "Always allow" checkbox only on personal computers
- WiFi debugging is less secure than USB - use on trusted networks only
- SCRCPY-REFERENCE.md - Complete scrcpy keyboard shortcuts and command-line options
- ADB-REFERENCE.md - Comprehensive ADB command reference (400+ commands)
- AUTOMATION-COOKBOOK.md - Automation recipes and cool tricks
- OPTIMIZATION-GUIDE.md - Performance and battery optimization techniques
- ORGANIZATION-GUIDE.md - File organization and duplicate cleanup
- QUICK-REFERENCE.md - Quick command cheat sheet
Personal use - Part of LAB workspace
Last Updated: 2025-10-02 Maintainer: Mickael Souedan