TERMUX_MASTERCLASS
 ████████╗███████╗██████╗ ███╗   ███╗██╗   ██╗██╗  ██╗
 ╚══██╔══╝██╔════╝██╔══██╗████╗ ████║██║   ██║╚██╗██╔╝
    ██║   █████╗  ██████╔╝██╔████╔██║██║   ██║ ╚███╔╝ 
    ██║   ██╔══╝  ██╔══██╗██║╚██╔╝██║██║   ██║ ██╔██╗ 
    ██║   ███████╗██║  ██║██║ ╚═╝ ██║╚██████╔╝██╔╝ ██╗
    ╚═╝   ╚══════╝╚═╝  ╚═╝╚═╝     ╚═╝ ╚═════╝ ╚═╝  ╚═╝

Termux Complete Command Guide — Basic se Advance tak

Yeh page Termux ke sabhi zaruri commands ko step-by-step, detail ke saath cover karta hai — kya karta hai, kaise use hota hai, aur real syntax kya hai. Har command ke saamne ek Copy button hai. Search box me type karke turant command dhoondh sakte ho.

📱 Mobile + 🖥️ PC dono ke liye responsive 📋 One-click copy 🔥 200+ commands, basic se advance tak ⚠️ Ethical use only
01

Basic Commands

Yeh wo pehle commands hain jo har Termux user ko sabse pehle seekhne chahiye — file system me ghumna, dekhna, banana, delete karna.

pwd basic

pwd

Present Working Directory — batata hai ki abhi aap kis folder me ho. Jab confuse ho jao ki kaha ho, yeh command chalao.

ls

ls
ls -la

Current folder ki files aur folders list karta hai. -la lagane se hidden files (jo "." se start hoti hain) aur detail (permission, size, date) bhi dikhta hai.

cd

cd foldername
cd ..
cd ~

Change Directory — ek folder se dusre folder me jaane ke liye. cd .. se ek folder peeche jaate hain, cd ~ se seedha home folder me.

mkdir

mkdir myfolder

Make Directory — naya folder banata hai. Multiple folders banane ke liye: mkdir folder1 folder2

touch

touch file.txt

Empty (khaali) file banata hai. Agar file already ho to sirf uski "last modified" time update karta hai.

rm / rm -r

rm file.txt
rm -rf foldername

Remove — file delete karta hai. -r se folder (recursively andar ki sab files) delete hota hai, -f se bina confirmation ke force delete. Ise dhyan se use karo, delete hone ke baad recover nahi hota.

cp

cp source.txt destination.txt
cp -r folder1 folder2

Copy — file ya folder (with -r) ko ek jagah se dusri jagah copy karta hai, original wahi rehta hai.

mv

mv file.txt newname.txt
mv file.txt /sdcard/

Move — file/folder ko ek jagah se dusri jagah move karta hai, ya rename bhi karta hai agar sirf naam badla jaye.

cat

cat file.txt

File ka poora content terminal me print karta hai. Chote files padhne ke liye useful, badi files ke liye less use karo.

nano

nano file.txt

Terminal ke andar text editor open karta hai jisme file edit kar sakte ho. Save karne ke liye CTRL+O phir Enter, exit ke liye CTRL+X.

clear

clear

Terminal screen ko saaf kar deta hai, purani commands hat jaati hain (delete nahi hoti, bas screen se hat jaati hain).

exit

exit

Current terminal session ko band kar deta hai.

history

history

Aapne ab tak jo bhi commands type ki hain unki list dikhata hai — purani command dobara dhoondhne ke liye kaam aata hai.

man

man ls

Manual — kisi bhi command ka poora official documentation dikhata hai (kya options hain, kaise use hota hai). Exit karne ke liye q dabao.

echo

echo "Hello World"

Screen par text print karta hai. Scripts me variable ki value dikhane ke liye bhi use hota hai.

whoami

whoami

Batata hai ki abhi kaunsa user logged in hai.

date & cal

date
cal

date current date-time dikhata hai, cal current month ka calendar terminal me print karta hai.

uname -a

uname -a

System/kernel ki puri information dikhata hai — OS type, kernel version, architecture (arm64 etc.). Debugging ke waqt useful.

hostname

hostname

Device ka network hostname (naam) dikhata hai.

which / type

which python
type cd

which batata hai ki koi command ki actual file kaha installed hai. type batata hai ki wo command, alias hai, function hai, ya built-in.

less / more

less file.txt

Badi files ko scroll karke page-by-page padhne ke liye — cat jaisa poora print nahi karta. Exit ke liye q dabao.

ln (symlink)

ln -s /path/original /path/shortcut

Ek file/folder ka shortcut (symbolic link) banata hai jo original file ki taraf point karta hai.

stat

stat file.txt

File ki detailed information dikhata hai — size, permissions, last access/modify time, inode number.

file

file document.pdf

Batata hai ki koi file actually kis type ki hai (text, image, executable, archive) — extension galat ho tab bhi asli type detect karta hai.

basename / dirname

basename /sdcard/photo.jpg
dirname /sdcard/photo.jpg

basename path se sirf file ka naam nikalta hai, dirname sirf folder ka path nikalta hai — scripting me bahut kaam aata hai.

printf

printf "Name: %s Age: %d\n" "Raj" 21

echo jaisa hi, par formatted output ke liye zyada powerful — variables ko specific type (%s string, %d number) me print karta hai.

reset

reset

Terminal agar corrupt/garbled ho jaye (jaise binary file cat karne ke baad), to terminal ki settings poori tarah reset kar deta hai.

02

File & Storage Management

Phone ki storage access karna, permissions set karna, files search karna.

termux-setup-storage

termux-setup-storage

Phone ki internal storage (Photos, Downloads, DCIM) ko Termux se access karne ki permission deta hai. Run karne ke baad home folder me ek storage folder ban jaata hai jisse gallery, downloads, etc. access ho jaati hai.

chmod

chmod +x script.sh
chmod 755 file

File ki permissions (read/write/execute) change karta hai. +x se file ko executable (chalane layak) banate hain — scripts run karne se pehle zaruri hota hai.

find

find . -name "*.txt"

Files ko naam ya pattern se search karta hai. Yeh command current folder aur uske andar ke sab sub-folders me dhoondhta hai.

du

du -sh foldername

Disk Usage — batata hai ki koi folder kitni storage (MB/GB) le raha hai.

df

df -h

Poore device ki total aur free storage space dikhata hai, human-readable format (GB/MB) me.

tar (zip/unzip)

tar -czvf backup.tar.gz foldername/
tar -xzvf backup.tar.gz

Files/folders ko compress (-czvf) ya extract (-xzvf) karta hai — backup banane ke liye useful.

termux-setup-storage (shared)

ls ~/storage/shared/
ls ~/storage/downloads/

Setup-storage chalane ke baad phone ki shared storage aur downloads folder yaha se access hoti hai.

rmdir

rmdir emptyfolder

Sirf khaali (empty) folder ko delete karta hai. Agar folder me files hain to error dega — us case me rm -r use karo.

cp -v / mv -v (verbose)

cp -rv folder1 folder2

-v (verbose) lagane se copy/move hote hue har file ka naam terminal me print hota hai — bade operations track karne ke liye.

rsync

pkg install rsync
rsync -avh source/ destination/

cp se zyada smart — sirf changed/new files hi copy karta hai, badi backups ke liye time aur data dono bachata hai.

zip / unzip

pkg install zip unzip
zip -r archive.zip folder/
unzip archive.zip

Windows-compatible .zip files banane aur extract karne ke liye — sabse common archive format.

readlink

readlink -f file.txt

File ka full/absolute path nikalta hai, symlink ho to uska original target bhi dikhata hai.

truncate

truncate -s 10M testfile

Ek fixed size ki dummy/test file turant bana deta hai (yaha 10MB) — bina actual data likhe.

md5sum / sha256sum

sha256sum file.zip

File ka unique hash/checksum nikalta hai — download ki file corrupt/tamper to nahi hui, yeh verify karne ke liye.

03

Package Management

Termux me naye tools/software install karne, update karne aur remove karne ke commands.

pkg update && pkg upgrade must run first

pkg update && pkg upgrade -y

Sabse pehla command jo naya Termux install karne ke baad chalana chahiye. Yeh sabhi packages ki latest list fetch karta hai aur unhe update karta hai. -y se sab confirmation auto "yes" ho jaate hain.

pkg install

pkg install packagename

Naya package/software install karta hai. Example: pkg install python, pkg install git.

pkg uninstall

pkg uninstall packagename

Kisi installed package ko remove kar deta hai.

pkg list-installed

pkg list-installed

Abhi tak jitne bhi packages install hain unki poori list dikhata hai.

pkg search

pkg search keyword

Kisi keyword se related available packages search karta hai.

apt (alternative)

apt update && apt upgrade

pkg asal me apt ka hi ek simplified wrapper hai — dono kaam same karte hain, pkg beginners ke liye easier hai.

python & pip

pkg install python
pip install requests

Python install karta hai, aur pip se Python libraries install ki jaati hain.

git

pkg install git
git clone https://github.com/user/repo.git

Git version control install karta hai, aur git clone se GitHub se koi bhi public project directly Termux me download hota hai.

clang / nodejs

pkg install clang nodejs

C/C++ compiler aur Node.js install karta hai — programming/coding karne ke liye.

pkg show

pkg show packagename

Kisi package ki details (version, dependencies, size, description) install kiye bina hi dikhata hai.

pkg files

pkg files packagename

Ek installed package ke andar kaunsi files/binaries aayi hain, unki list dikhata hai.

pkg clean / autoclean

pkg clean

Downloaded package cache files (jo install ke baad kaam ke nahi rehte) delete karke storage space free karta hai.

dpkg -l

dpkg -l

Low-level package manager command — sabhi installed packages ki detailed list version ke saath dikhata hai.

termux-change-repo

termux-change-repo

Package download servers (mirrors) badalne ke liye — agar default repo slow ho ya kaam na kare to nearest/fastest mirror choose kar sakte ho.

ruby / perl / golang

pkg install ruby perl golang

Ruby, Perl aur Go programming languages install karta hai, agar in languages me code likhna/chalana ho.

04

Networking Commands

Internet, IP address aur connections check karne ke liye commands.

ping

ping google.com

Check karta hai ki koi website/server reachable hai ya nahi, aur response time (latency) dikhata hai. Rokne ke liye CTRL+C.

curl

curl https://example.com
curl -O https://example.com/file.zip

Kisi bhi URL se data fetch/download karta hai. -O se file ko usi naam se save kar deta hai.

wget

wget https://example.com/file.zip

Internet se seedha file download karta hai — curl jaisa hi, par downloads ke liye zyada common.

ifconfig / ip addr

pkg install net-tools
ifconfig

Device ka IP address aur network interfaces dikhata hai. Pehle net-tools install karna padta hai kyuki yeh Termux me by default nahi aata.

ssh

pkg install openssh
ssh username@ip_address

Kisi doosre server/device se securely remote connect karne ke liye. Termux khud ek SSH server bhi ban sakta hai (sshd start karke) taaki PC se apne phone ko control kar sako.

speedtest-cli

pip install speedtest-cli
speedtest-cli

Internet ki download/upload speed terminal se hi check karta hai.

traceroute / tracepath

pkg install traceroute
traceroute google.com

Data packet apni manzil (destination) tak pahunchne se pehle kin-kin servers (hops) se guzarta hai, yeh route dikhata hai.

dig / nslookup

pkg install dnsutils
dig google.com

Kisi domain name ka DNS record (IP address, mail server, etc.) query karta hai — DNS debugging ke liye standard tool.

whois

pkg install whois
whois example.com

Kisi domain ki registration details (owner, registrar, expiry date) fetch karta hai.

netstat / ss

pkg install net-tools
netstat -tulnp

Device par konse network ports open hain aur kaunsi services unpar listen kar rahi hain, yeh dikhata hai.

scp

scp file.txt user@ip:/path/

Secure Copy — SSH ke through ek device se doosre device me files transfer karta hai.

rclone

pkg install rclone
rclone config

Google Drive, Dropbox jaisi cloud storage services ke saath files sync/upload/download karne ke liye command-line tool.

python -m http.server

python -m http.server 8080

Current folder ko turant ek simple web server bana deta hai — files ko local network me share karne ka fastest tarika.

05

Termux:API Commands

Yeh commands phone ke hardware/features (camera, battery, location, SMS) ko control karte hain. Inke liye Play Store se alag se "Termux:API" app install karni padti hai + pkg install termux-api chalana padta hai.

termux-api setup required

pkg install termux-api

Yeh package install karo aur saath me Termux:API app bhi install karo, tabhi neeche wale commands kaam karenge.

termux-battery-status

termux-battery-status

Battery percentage, temperature aur charging status JSON format me dikhata hai.

termux-camera-photo

termux-camera-photo -c 0 photo.jpg

Camera se photo click karta hai. -c 0 back camera, -c 1 front camera ke liye.

termux-location

termux-location

Device ki current GPS location (latitude/longitude) fetch karta hai.

termux-clipboard-get/set

termux-clipboard-set "Hello"
termux-clipboard-get

Phone ke clipboard me text copy karta hai ya usse read karta hai.

termux-toast

termux-toast "Hello from Termux"

Screen par ek chhota popup message (toast) dikhata hai.

termux-vibrate

termux-vibrate -d 1000

Phone ko vibrate karata hai, -d se duration milliseconds me set hoti hai.

termux-notification

termux-notification --title "Alert" --content "Task done"

Notification bar me custom notification bhejta hai — scripts complete hone par alert dene ke liye useful.

termux-wake-lock

termux-wake-lock

Phone ko sleep/lock hone se rokta hai taaki background me chal rahi script band na ho.

termux-wake-unlock

termux-wake-unlock

termux-wake-lock ko wapas hata deta hai taaki phone normally sleep kar sake.

termux-sms-list

termux-sms-list

Phone ke SMS inbox ke messages JSON format me list karta hai (permission maangega).

termux-sms-send

termux-sms-send -n 9999999999 "Hello"

Terminal se directly kisi number par SMS bhej deta hai — automation scripts ke liye useful.

termux-telephony-call

termux-telephony-call 9999999999

Terminal command se hi phone call dial kar deta hai.

termux-telephony-deviceinfo

termux-telephony-deviceinfo

SIM/network operator, signal strength jaisi telephony details JSON me dikhata hai.

termux-contact-list

termux-contact-list

Phone ki saari contacts ki list JSON format me nikalta hai.

termux-volume

termux-volume music 10

Phone ke volume streams (music, ring, alarm etc.) ko control karta hai.

termux-torch

termux-torch on
termux-torch off

Phone ki flashlight (torch) ko on/off karta hai.

termux-brightness

termux-brightness 150

Screen brightness ko terminal se set karta hai (0-255 ke beech value).

termux-wifi-connectioninfo

termux-wifi-connectioninfo

Connected WiFi network ka naam, signal strength aur link speed dikhata hai.

termux-tts-speak

termux-tts-speak "Hello Termux"

Text-to-Speech — diya gaya text phone se bolwa deta hai.

termux-dialog

termux-dialog text -t "Enter name"

Scripts ke liye popup input box (text, checkbox, spinner, date-picker etc.) dikhata hai — user se input lene ke liye.

termux-share

termux-share file.txt

Android ke normal "Share" menu ke through kisi file ko doosri apps me bhej deta hai.

termux-open

termux-open file.pdf

File ya URL ko default associated app me open kar deta hai (jaise PDF ko PDF reader me).

termux-fingerprint

termux-fingerprint

Fingerprint sensor se authentication prompt dikhata hai — secure scripts banane ke liye.

06

Ethical Hacking / Cybersecurity Tools

Zaroori disclaimer: Yeh tools sirf apni khud ki devices/networks par, ya jinke liye aapke paas likhit (written) permission ho, unhi par test karo. Bina permission kisi doosre ke system/network par inhe use karna apne country ke cyber-laws (jaise IT Act) ke under illegal hai aur ismein jail bhi ho sakti hai. Yeh section sirf sikhne aur apne systems secure karne ke liye hai.

nmap network scanner

pkg install nmap
nmap 192.168.1.1
nmap -sV 192.168.1.0/24

Network Mapper — apne network me kaunse devices connected hain aur unpar kaunse ports/services open hain, yeh check karta hai. -sV se services ka version bhi milta hai. Security audits ke liye industry-standard tool.

hydra login tester

pkg install hydra

Apne khud ke router/server ke login ki password strength test karne ke liye use hota hai (brute-force testing tool). Sirf apni devices par hi use karo — kisi aur ke account par use karna cyber-crime hai.

sqlmap web security

pkg install python git
git clone https://github.com/sqlmapproject/sqlmap.git

Apni khud ki website/web-app me SQL injection vulnerabilities check karne ke liye popular open-source tool. Sirf apni owned website par test karo.

proot-distro (Kali/Ubuntu)

pkg install proot-distro
proot-distro install kali
proot-distro login kali

Termux ke andar puri Kali Linux ya Ubuntu jaisi OS chala sakte ho — advanced pentesting tools iske andar available hote hain jo normal Termux me directly nahi milte.

tor + proxychains

pkg install tor proxychains-ng

Apni internet browsing/traffic ko anonymize/route karne ke liye — privacy research aur anonymous testing labs setup karne ke liye.

wireshark alternative: tcpdump

pkg install tcpdump
tcpdump -i any

Apne network interface se guzarne wale packets ko capture/analyze karta hai — network traffic samajhne ke liye.

metasploit-framework

pkg install unstable-repo
pkg install metasploit

Duniya ka sabse popular penetration-testing framework — apne khud ke test-lab systems par vulnerabilities check karne ke liye. Bina permission use karna strictly illegal hai.

nikto

pkg install nikto
nikto -h https://apnasite.com

Apni khud ki website par common misconfigurations aur outdated software scan karta hai.

john the ripper

pkg install john

Password strength test karne ke liye password-cracking/audit tool — sirf apni khud ki files/accounts par test karo.

fail2ban

pkg install fail2ban

Baar-baar galat login attempts karne wale IPs ko automatically block karta hai — apne SSH server ko brute-force se bachane ke liye.

openssl

openssl genrsa -out key.pem 2048
openssl s_client -connect example.com:443

Encryption keys generate karne aur kisi website ke SSL/TLS certificate ki details check karne ke liye standard tool.

aircrack-ng

pkg install root-repo
pkg install aircrack-ng

WiFi security research ke liye tool-suite — sirf apne khud ke router par security test karne ke liye (rooted device aur monitor-mode support wale WiFi adapter ki zarurat padti hai).

07

Advanced & "Secret" Power-User Commands

Yeh wo commands hain jo zyadatar naye users ko pata nahi hote — Termux ko real power-tool banane ke liye.

alias

alias update="pkg update && pkg upgrade -y"

Lambi commands ka short naam bana sakte ho. Permanent karne ke liye ise ~/.bashrc file me daal do.

termux-reload-settings

termux-reload-settings

Termux ki termux.properties file me kiye gaye changes (jaise font, extra keys) ko bina app restart kiye apply karta hai.

termux-services (sv)

pkg install termux-services
sv-enable sshd

Background services (jaise SSH server) ko manage karta hai taaki wo Termux band hone par bhi automatically restart ho jaayein.

&& , ; , | (chaining)

pkg update && pkg upgrade
ls | grep ".txt"

&& se do commands ek ke baad ek chalti hain (agar pehli success ho). | (pipe) se ek command ka output doosri command ko input ki tarah diya jaata hai — bahut powerful trick.

crontab / termux-job-scheduler

pkg install cronie

Commands/scripts ko ek fix time par automatically run karwane ke liye scheduling tool.

screen / tmux

pkg install tmux
tmux

Multiple terminal sessions ko ek hi window me split karke chalane deta hai, aur session ko background me chalta rehne deta hai chahe app band ho jaye.

figlet + lolcat (fun/style)

pkg install figlet lolcat
figlet "HACKER" | lolcat

Terminal me bade colorful ASCII-art letters print karta hai — hacker-style intro banane ke liye popular trick.

.bashrc customization

nano ~/.bashrc

Yeh file har baar Termux open hote hi run hoti hai — ismein alias, custom prompt color, welcome message set kar sakte ho.

top / htop

pkg install htop
htop

Live me CPU, RAM aur running processes ka usage dikhata hai — Task Manager jaisa terminal version.

termux-boot (auto-start scripts)

pkg install termux-boot

Phone restart hote hi apne scripts ko ~/.termux/boot/ folder se automatically run karwane deta hai (Termux:Boot app bhi chahiye).

termux-style (fonts & colors)

termux-setup-storage && termux-reload-settings

~/.termux/font.ttf aur ~/.termux/colors.properties files daal kar terminal ka font aur color-theme fully customize kar sakte ho.

function (bash function)

greet() { echo "Hello $1"; }

Chhote reusable code-blocks banane ke liye — alias se zyada powerful, isme arguments ($1, $2) bhi le sakte ho.

chsh (change shell)

pkg install zsh
chsh -s zsh

Default shell ko bash se zsh (ya fish) me switch karta hai — better autocomplete aur themes ke liye popular.

termux-api (widget shortcuts)

pkg install termux-widget

Home-screen par tap-to-run shortcuts banata hai apne ~/.shortcuts/ folder ke scripts ke liye.

08

Text Processing & Filters

Files/output ke text ko search, filter, sort aur transform karne ke commands — scripting aur log-analysis me sabse zyada use hote hain.

grep

grep "error" logfile.txt
grep -ri "error" logfile.txt

Kisi file/output me ek specific word ya pattern dhoondh kar us line ko print karta hai. -i case-ignore, -r folder ke andar recursively search.

sed

sed 's/old/new/g' file.txt

Stream Editor — file ke andar text ko find-and-replace karta hai bina file ko manually khole. g se puri line me sab occurrences replace hote hain.

awk

awk '{print $1}' file.txt

Columns/fields wale data ko process karne ke liye powerful language — yaha har line ka pehla column print ho raha hai.

sort

sort file.txt
sort -nr numbers.txt

File ki lines ko alphabetically sort karta hai. -n numeric sort, -r reverse order ke liye.

uniq

sort file.txt | uniq
sort file.txt | uniq -c

Duplicate (repeated) lines ko hata deta hai. -c se har unique line kitni baar aayi, uska count bhi milta hai.

wc

wc -l file.txt

Word Count — file ki lines (-l), words (-w), ya characters (-c) ginta hai.

head / tail

head -n 10 file.txt
tail -f log.txt

File ka shuru (head) ya end (tail) print karta hai. tail -f se live log file ko real-time follow kar sakte ho.

cut

cut -d: -f1 /etc/passwd

Kisi delimiter (yaha :) ke basis par har line se ek specific column nikalta hai.

tr

echo "hello" | tr 'a-z' 'A-Z'

Translate — characters ko replace/delete karta hai. Yaha lowercase text ko uppercase me convert kar raha hai.

diff

diff file1.txt file2.txt

Do files ke beech ka difference (kaunsi lines alag hain) dikhata hai — code/config compare karne ke liye.

xargs

find . -name "*.log" | xargs rm

Ek command ka output doosri command ke arguments ki tarah pass karta hai — yaha saari .log files ek saath delete ho rahi hain.

tee

ls | tee output.txt

Command ka output screen par bhi dikhata hai aur ek file me bhi save kar deta hai, same time par.

jq (JSON parsing)

pkg install jq
cat data.json | jq '.name'

JSON data ko command-line se hi filter/format karne ke liye — APIs (jaise termux-battery-status) ke output ko process karne ke liye bahut useful.

column

column -t file.csv

Space/tab se separated text ko neat, aligned table jaisa format me terminal me print karta hai.

09

Process & System Management

Running programs (processes) ko dekhna, control karna aur system ki health check karne ke commands.

ps

ps aux

Abhi kaunse processes/programs chal rahe hain, unki poori list (PID, CPU/memory usage sahit) dikhata hai.

kill

kill 1234
kill -9 1234

Process ID (PID) se kisi program ko force-stop karta hai. -9 se turant/forcefully band hota hai.

pkill / pgrep

pkill node

PID yaad rakhne ki jagah process ke naam se hi use kar/dhoondh sakte ho — pkill stop karta hai, pgrep sirf PID dikhata hai.

jobs, bg, fg

jobs
command &
fg %1

& lagane se command background me chalti hai, jobs unhe list karta hai, fg wapas foreground me le aata hai.

nohup

nohup python script.py &

Terminal band hone ke baad bhi script/process chalta rehta hai — long-running scripts ke liye zaruri.

free

free -h

RAM ka total, used aur free memory human-readable format (GB/MB) me dikhata hai.

uptime

uptime

Device/session kitni der se on/running hai, aur average system load dikhata hai.

termux-info

termux-info

Termux version, Android version, architecture jaisi puri debug-info ek saath dikhata hai — bug-report share karte waqt useful.

id / groups

id

Current user ka user-ID, group-ID aur konse groups me hai, yeh dikhata hai.

watch

pkg install procps
watch -n 2 free -h

Kisi command ko har kuch second (yaha 2 sec) me automatically re-run karke live output dikhata hai.

termux-chroot / tsu

pkg install tsudo

Rooted devices par root-level access (superuser) commands chalane ke liye — non-rooted phones par kaam nahi karta.

time

time ls -la

Koi bhi command chalane me kitna time laga, wo measure karke dikhata hai — scripts optimize karne ke liye useful.

10

Git Version Control

Code ka version-history maintain karne aur GitHub/GitLab ke saath kaam karne ke commands.

git config first time setup

git config --global user.name "Your Name"
git config --global user.email "you@example.com"

Git use karne se pehle apna naam aur email set karna zaruri hai — yeh har commit ke saath attach hota hai.

git init

git init

Current folder ko ek naya Git repository bana deta hai — version tracking yahi se shuru hoti hai.

git clone

git clone https://github.com/user/repo.git

GitHub/GitLab par maujood kisi bhi repository ko poori history ke saath apne device me download karta hai.

git status

git status

Batata hai ki kaunsi files change hui hain, kaunsi staged hain, aur kaunsi track hi nahi ho rahi.

git add

git add file.txt
git add .

Changes ko "staging area" me daalta hai — . se saari changed files ek saath add ho jaati hain.

git commit

git commit -m "message"

Staged changes ka ek permanent snapshot (commit) save karta hai, saath me ek message jo batata hai ki kya change kiya.

git push

git push origin main

Apne local commits ko remote server (GitHub) par upload karta hai.

git pull

git pull origin main

Remote repository me hue latest changes ko apne local folder me download/merge karta hai.

git branch

git branch
git branch new-feature

Existing branches list karta hai ya naya branch banata hai — alag features par bina main code disturb kiye kaam karne ke liye.

git checkout / switch

git checkout branch-name

Ek branch se doosre branch me switch karta hai.

git log

git log --oneline

Ab tak ke saare commits ki history dikhata hai — --oneline se compact, ek-line format me.

git diff

git diff

Last commit ke muqable abhi files me kya-kya exact changes hue hain, line-by-line dikhata hai.

git stash

git stash
git stash pop

Incomplete changes ko temporarily "side me rakh" deta hai bina commit kiye, taaki clean branch switch ho sake. pop se wapas laa sakte ho.

git merge

git merge branch-name

Ek branch ke changes ko doosre branch me combine (merge) karta hai.

git reset

git reset --hard HEAD~1

Last commit ko poori tarah undo kar deta hai — ise dhyan se use karo, changes permanently khatam ho jaate hain.

11

Vim Editor Basics

nano ke alawa Termux me powerful vim editor bhi available hai. Shuru me thoda tricky lagta hai par bahut fast hai.

vim install required

pkg install vim
vim file.txt

Vim install karke kisi file ko open karta hai. Vim me 2 modes hote hain — Normal (commands) aur Insert (typing).

i (insert mode)

i

Normal mode se Insert mode me jaata hai, tabhi text type kar sakte ho. Bahar aane ke liye Esc dabao.

:w (save)

:w

Normal mode me file ko save (write) karta hai, bina exit kiye.

:q / :q!

:q
:q!

Vim se exit karta hai. :q! se bina save kiye, force exit hota hai.

:wq (save & quit)

:wq

File ko save karke turant Vim se bahar bhi nikal jaata hai — sabse common exit command.

dd (delete line)

dd

Normal mode me cursor jis line par hai, poori line delete kar deta hai.

yy / p (copy-paste)

yy
p

yy se current line copy (yank) hoti hai, p se usko cursor ke neeche paste karte hain.

/search

/keyword

File ke andar kisi word ko search karta hai. n dabakar next match par jump karo.

u (undo)

u

Last change ko undo karta hai — galti se kuch delete/change ho gaya ho to isse wapas laa sakte ho.

12

Shell Scripting & Environment Variables

Apne khud ke automation scripts banane aur environment variables manage karne ke commands.

#!/bin/bash (shebang)

#!/data/data/com.termux/files/usr/bin/bash

Har script file ki pehli line — batata hai ki yeh script kaunse interpreter (yaha bash) se run honi chahiye.

bash script.sh

bash script.sh
./script.sh

Ek shell script file ko run karta hai. ./ se direct chalane ke liye pehle chmod +x karna padta hai.

export (environment variable)

export API_KEY="12345"

Ek variable set karta hai jo current session ke sub-processes/scripts me bhi accessible rehta hai.

echo $PATH

echo $PATH

System kis-kis folder me commands dhoondhta hai, uski list dikhata hai — "command not found" errors debug karne me kaam aata hai.

if / else

if [ -f file.txt ]; then echo "exists"; fi

Scripts me condition check karne ke liye — yaha check ho raha hai ki file exist karti hai ya nahi.

for loop

for i in 1 2 3; do echo $i; done

Same command ko multiple values par baar-baar repeat karta hai.

while loop

while true; do echo "running"; sleep 1; done

Ek condition true hone tak commands ko baar-baar repeat karta hai — yaha infinite loop chal raha hai jo har 1 second me print karta hai.

read (user input)

read -p "Enter name: " name

Script chalte waqt user se terminal me input lene ke liye — yaha input name variable me store hota hai.

$1, $2 (script arguments)

./script.sh hello world

Script ko command-line se diye gaye arguments $1, $2 variables ke through script ke andar access hote hain.

sleep

sleep 5

Script/terminal ko diye gaye seconds tak pause (wait) karta hai.

source / . (dot)

source ~/.bashrc

Kisi script file ko current shell session me hi execute karta hai (naya sub-shell nahi khulta) — .bashrc me kiye changes turant apply karne ke liye.

13

Compression & Archives

Files/folders ko compress karke storage bachane aur transfer karne ke commands.

gzip / gunzip

gzip file.txt
gunzip file.txt.gz

Single file ko .gz format me compress/decompress karta hai — original file ki jagah compressed file ban jaati hai.

bzip2 / bunzip2

pkg install bzip2
bzip2 file.txt

gzip jaisa hi, par thoda better compression ratio deta hai (par speed thodi slow hoti hai).

7z (7-zip)

pkg install p7zip
7z a archive.7z folder/

Sabse high compression ratio wala format — badi files ko sabse chhota size me compress karta hai.

tar.bz2 / tar.xz

tar -cjvf backup.tar.bz2 folder/

tar ko alag compression algorithms (bzip2, xz) ke saath combine karke behtar compression ratio milta hai.

unrar

pkg install unrar
unrar x file.rar

.rar format ki archives ko extract karta hai — Windows se aayi files ke liye common.

14

Media, Downloads & Conversion Tools

Videos, audio, aur images ko terminal se hi download, convert aur edit karne ke tools.

yt-dlp popular

pkg install python && pip install yt-dlp
yt-dlp "https://youtube.com/watch?v=..."

YouTube aur 1000+ sites se videos/audio download karne ka sabse popular command-line tool. Sirf apni khud ki ya copyright-free content download karo.

ffmpeg

pkg install ffmpeg
ffmpeg -i input.mp4 output.mp3

Video/audio convert, trim, merge, compress karne ka industry-standard tool — yaha video ko audio(mp3) me convert kar raha hai.

imagemagick (convert)

pkg install imagemagick
convert photo.png photo.jpg

Images ka format convert karna, resize karna, ya batch-edit karna — terminal se hi image editing ka powerful tool.

cmus (music player)

pkg install cmus
cmus

Terminal ke andar hi ek lightweight music player chalata hai — apni ~/storage/music folder ki songs play karne ke liye.

mpv (video player)

pkg install mpv
mpv video.mp4

Lightweight command-line video/audio player, streaming URLs bhi directly play kar sakta hai.

qrencode

pkg install qrencode
qrencode -o code.png "Hello"

Kisi bhi text/URL ka QR code image bana deta hai terminal se hi.

15

Pro Tips

Keyboard shortcuts

CTRL+C — running command ko stop karo
CTRL+L — screen clear (clear command jaisa)
CTRL+A then D — tmux session ko background me chhod do
Volume Down + Q/W/E — Termux ke extra symbol keys (Esc, Tab, arrows) access karo

Tab completion

Command ya file naam type karte waqt Tab dabao — Termux khud auto-complete kar dega. Time bachata hai aur typo se bachaata hai.

Storage location

Termux setup-storage ke baad phone ki files ~/storage/shared/ ya ~/storage/downloads/ me milti hain.