All     Ethical Hacking     Networking     Programming     OSINT

Bash Scripting in Termux – Installation & Basic Commands

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 -y

Create a new bash script:

nano script.sh

Add this code:

#!/bin/bash
echo "Hello Termux!"

Give the script permission to run:

chmod +x script.sh

Run the script:

./script.sh

Basic Commands

Run any bash file:

bash filename.sh

Check current shell:

echo $SHELL

Show bash version:

bash --version

List files in directory:

ls

Print text in terminal:

echo "Hello"

Make a directory:

mkdir foldername

Uninstall bash (not recommended because Termux uses it):

pkg uninstall bash