Termux:Boot lets you run shell scripts automatically whenever your Android device starts up. Place executable scripts inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/termux/termux-app/llms.txt
Use this file to discover all available pages before exploring further.
~/.termux/boot/ and they will be executed in the background each time the device completes its boot sequence. This is useful for starting SSH daemons, launching background services, or running any initialization logic your workflow depends on.
How it works
Termux:Boot registers an AndroidBOOT_COMPLETED broadcast receiver. When the device finishes booting, Android sends this broadcast and Termux:Boot wakes up, then executes each script found in ~/.termux/boot/ in alphabetical order. Scripts run inside the Termux environment with access to all installed packages.
The main Termux app does not need to be open for boot scripts to run — Termux:Boot starts the Termux runtime in the background.
Installation and setup
Install the Termux:Boot APK
Download the APK from the same source as your Termux app (F-Droid or GitHub). Install it on your device.
Open Termux:Boot once
Launch the Termux:Boot app from your app drawer at least once. This step registers the boot receiver with Android — without it, the app will not run scripts on boot.
Create the boot scripts directory
In the Termux terminal, create the directory where boot scripts will live:
Writing boot scripts
Boot scripts run in a non-interactive background environment. Keep the following in mind: Use the full Termux shebang path. Android does not have/bin/bash. Scripts must reference the Termux binary path:
nohup for long-running processes. Scripts run synchronously during boot. If a process does not exit on its own, use nohup to detach it:
tmux or screen:
Example: start SSH and a cron daemon on boot
Multiple scripts
You can place multiple scripts in~/.termux/boot/. They are executed in alphabetical order by filename. Use numeric prefixes to control execution order:
Android may kill background processes to reclaim memory. For critical services, consider disabling battery optimization for Termux via Android Settings → Battery → Termux → Unrestricted.