The termux module integrates various Android-specific features into the Termux terminal, allowing for hardware interaction and easy management of isolated Linux environments.
When to Activate
- When the user wants to interact with Android sensors or hardware (battery, vibration, volume).
- When performing SMS management (reading or sending messages) via CLI.
- When using text-to-speech (
say) capabilities on an Android device. - When installing or managing Linux distributions (Ubuntu, Alpine, Debian) using PRoot without root access.
Core Principles & Rules
- API Dependencies: Remind users that
termux-apimust be installed for hardware subcommands. - Rootless environments: Emphasize that
proot-distroallows running full Linux environments without rooting the device. - Shortcuts: Support for the
malias (default shortcut forx termux).
Patterns & Examples
Hardware Interaction
# Make the phone vibrate for 500ms
x termux vibrate 500
# Speak text using the Android voice engine
x termux say "System update complete"
PRoot Management
# Install and run an Ubuntu environment
x termux pd install ubuntu
x termux ubu bash
SMS Management
# Send an SMS message to a specific number
x termux sms send -n 123456789 "Hello from x-cmd"
Checklist
- Verify if the
termux-apipackage is installed for hardware tasks. - Confirm the target Linux distribution name for PRoot commands.
- Ensure the Android device has the necessary permissions granted to Termux.