Bash is already built into Termux, so you can write and run shell scripts without installing anything extra. Bash scripting helps automate tasks, run commands together, and create useful tools directly from your Android phone. Below are the basic setup steps and the essential commands you need.
Installation
Bash comes pre-installed in Termux. Just update your packages:
pkg update && pkg upgrade -yCreate a new bash script:
nano script.shAdd this code:
#!/bin/bash
echo "Hello Termux!"Give the script permission to run:
chmod +x script.shRun the script:
./script.shBasic Commands
Run any bash file:
bash filename.shCheck current shell:
echo $SHELLShow bash version:
bash --versionList files in directory:
lsPrint text in terminal:
echo "Hello"Make a directory:
mkdir foldernameUninstall bash (not recommended because Termux uses it):
pkg uninstall bash