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
pwdPresent Working Directory — batata hai ki abhi aap kis folder me ho. Jab confuse ho jao ki kaha ho, yeh command chalao.
ls
lsls -laCurrent 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 foldernamecd ..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 myfolderMake Directory — naya folder banata hai. Multiple folders banane ke liye: mkdir folder1 folder2
touch
touch file.txtEmpty (khaali) file banata hai. Agar file already ho to sirf uski "last modified" time update karta hai.
rm / rm -r
rm file.txtrm -rf foldernameRemove — 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.txtcp -r folder1 folder2Copy — file ya folder (with -r) ko ek jagah se dusri jagah copy karta hai, original wahi rehta hai.
mv
mv file.txt newname.txtmv 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.txtFile ka poora content terminal me print karta hai. Chote files padhne ke liye useful, badi files ke liye less use karo.
nano
nano file.txtTerminal 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
clearTerminal screen ko saaf kar deta hai, purani commands hat jaati hain (delete nahi hoti, bas screen se hat jaati hain).
exit
exitCurrent terminal session ko band kar deta hai.
history
historyAapne ab tak jo bhi commands type ki hain unki list dikhata hai — purani command dobara dhoondhne ke liye kaam aata hai.
man
man lsManual — 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
whoamiBatata hai ki abhi kaunsa user logged in hai.
date & cal
datecaldate current date-time dikhata hai, cal current month ka calendar terminal me print karta hai.
uname -a
uname -aSystem/kernel ki puri information dikhata hai — OS type, kernel version, architecture (arm64 etc.). Debugging ke waqt useful.
hostname
hostnameDevice ka network hostname (naam) dikhata hai.
which / type
which pythontype cdwhich 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.txtBadi 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/shortcutEk file/folder ka shortcut (symbolic link) banata hai jo original file ki taraf point karta hai.
stat
stat file.txtFile ki detailed information dikhata hai — size, permissions, last access/modify time, inode number.
file
file document.pdfBatata 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.jpgdirname /sdcard/photo.jpgbasename 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" 21echo jaisa hi, par formatted output ke liye zyada powerful — variables ko specific type (%s string, %d number) me print karta hai.
reset
resetTerminal agar corrupt/garbled ho jaye (jaise binary file cat karne ke baad), to terminal ki settings poori tarah reset kar deta hai.
File & Storage Management
Phone ki storage access karna, permissions set karna, files search karna.
termux-setup-storage
termux-setup-storagePhone 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.shchmod 755 fileFile 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 foldernameDisk Usage — batata hai ki koi folder kitni storage (MB/GB) le raha hai.
df
df -hPoore 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.gzFiles/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 emptyfolderSirf 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 rsyncrsync -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 unzipzip -r archive.zip folder/unzip archive.zipWindows-compatible .zip files banane aur extract karne ke liye — sabse common archive format.
readlink
readlink -f file.txtFile ka full/absolute path nikalta hai, symlink ho to uska original target bhi dikhata hai.
truncate
truncate -s 10M testfileEk fixed size ki dummy/test file turant bana deta hai (yaha 10MB) — bina actual data likhe.
md5sum / sha256sum
sha256sum file.zipFile ka unique hash/checksum nikalta hai — download ki file corrupt/tamper to nahi hui, yeh verify karne ke liye.
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 -ySabse 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 packagenameNaya package/software install karta hai. Example: pkg install python, pkg install git.
pkg uninstall
pkg uninstall packagenameKisi installed package ko remove kar deta hai.
pkg list-installed
pkg list-installedAbhi tak jitne bhi packages install hain unki poori list dikhata hai.
pkg search
pkg search keywordKisi keyword se related available packages search karta hai.
apt (alternative)
apt update && apt upgradepkg asal me apt ka hi ek simplified wrapper hai — dono kaam same karte hain, pkg beginners ke liye easier hai.
python & pip
pkg install pythonpip install requestsPython install karta hai, aur pip se Python libraries install ki jaati hain.
git
pkg install gitgit clone https://github.com/user/repo.gitGit 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 nodejsC/C++ compiler aur Node.js install karta hai — programming/coding karne ke liye.
pkg show
pkg show packagenameKisi package ki details (version, dependencies, size, description) install kiye bina hi dikhata hai.
pkg files
pkg files packagenameEk installed package ke andar kaunsi files/binaries aayi hain, unki list dikhata hai.
pkg clean / autoclean
pkg cleanDownloaded package cache files (jo install ke baad kaam ke nahi rehte) delete karke storage space free karta hai.
dpkg -l
dpkg -lLow-level package manager command — sabhi installed packages ki detailed list version ke saath dikhata hai.
termux-change-repo
termux-change-repoPackage 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 golangRuby, Perl aur Go programming languages install karta hai, agar in languages me code likhna/chalana ho.
Networking Commands
Internet, IP address aur connections check karne ke liye commands.
ping
ping google.comCheck 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.comcurl -O https://example.com/file.zipKisi 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.zipInternet se seedha file download karta hai — curl jaisa hi, par downloads ke liye zyada common.
ifconfig / ip addr
pkg install net-toolsifconfigDevice 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 opensshssh username@ip_addressKisi 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-clispeedtest-cliInternet ki download/upload speed terminal se hi check karta hai.
traceroute / tracepath
pkg install traceroutetraceroute google.comData packet apni manzil (destination) tak pahunchne se pehle kin-kin servers (hops) se guzarta hai, yeh route dikhata hai.
dig / nslookup
pkg install dnsutilsdig google.comKisi domain name ka DNS record (IP address, mail server, etc.) query karta hai — DNS debugging ke liye standard tool.
whois
pkg install whoiswhois example.comKisi domain ki registration details (owner, registrar, expiry date) fetch karta hai.
netstat / ss
pkg install net-toolsnetstat -tulnpDevice 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 rclonerclone configGoogle 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 8080Current folder ko turant ek simple web server bana deta hai — files ko local network me share karne ka fastest tarika.
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-apiYeh package install karo aur saath me Termux:API app bhi install karo, tabhi neeche wale commands kaam karenge.
termux-battery-status
termux-battery-statusBattery percentage, temperature aur charging status JSON format me dikhata hai.
termux-camera-photo
termux-camera-photo -c 0 photo.jpgCamera se photo click karta hai. -c 0 back camera, -c 1 front camera ke liye.
termux-location
termux-locationDevice ki current GPS location (latitude/longitude) fetch karta hai.
termux-clipboard-get/set
termux-clipboard-set "Hello"termux-clipboard-getPhone 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 1000Phone 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-lockPhone ko sleep/lock hone se rokta hai taaki background me chal rahi script band na ho.
termux-wake-unlock
termux-wake-unlocktermux-wake-lock ko wapas hata deta hai taaki phone normally sleep kar sake.
termux-sms-list
termux-sms-listPhone 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 9999999999Terminal command se hi phone call dial kar deta hai.
termux-telephony-deviceinfo
termux-telephony-deviceinfoSIM/network operator, signal strength jaisi telephony details JSON me dikhata hai.
termux-contact-list
termux-contact-listPhone ki saari contacts ki list JSON format me nikalta hai.
termux-volume
termux-volume music 10Phone ke volume streams (music, ring, alarm etc.) ko control karta hai.
termux-torch
termux-torch ontermux-torch offPhone ki flashlight (torch) ko on/off karta hai.
termux-brightness
termux-brightness 150Screen brightness ko terminal se set karta hai (0-255 ke beech value).
termux-wifi-connectioninfo
termux-wifi-connectioninfoConnected 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.txtAndroid ke normal "Share" menu ke through kisi file ko doosri apps me bhej deta hai.
termux-open
termux-open file.pdfFile ya URL ko default associated app me open kar deta hai (jaise PDF ko PDF reader me).
termux-fingerprint
termux-fingerprintFingerprint sensor se authentication prompt dikhata hai — secure scripts banane ke liye.
Ethical Hacking / Cybersecurity Tools
nmap network scanner
pkg install nmapnmap 192.168.1.1nmap -sV 192.168.1.0/24Network 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 hydraApne 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 gitgit clone https://github.com/sqlmapproject/sqlmap.gitApni 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-distroproot-distro install kaliproot-distro login kaliTermux 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-ngApni internet browsing/traffic ko anonymize/route karne ke liye — privacy research aur anonymous testing labs setup karne ke liye.
wireshark alternative: tcpdump
pkg install tcpdumptcpdump -i anyApne network interface se guzarne wale packets ko capture/analyze karta hai — network traffic samajhne ke liye.
metasploit-framework
pkg install unstable-repopkg install metasploitDuniya 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 niktonikto -h https://apnasite.comApni khud ki website par common misconfigurations aur outdated software scan karta hai.
john the ripper
pkg install johnPassword strength test karne ke liye password-cracking/audit tool — sirf apni khud ki files/accounts par test karo.
fail2ban
pkg install fail2banBaar-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 2048openssl s_client -connect example.com:443Encryption keys generate karne aur kisi website ke SSL/TLS certificate ki details check karne ke liye standard tool.
aircrack-ng
pkg install root-repopkg install aircrack-ngWiFi 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).
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-settingsTermux 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-servicessv-enable sshdBackground services (jaise SSH server) ko manage karta hai taaki wo Termux band hone par bhi automatically restart ho jaayein.
&& , ; , | (chaining)
pkg update && pkg upgradels | 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 cronieCommands/scripts ko ek fix time par automatically run karwane ke liye scheduling tool.
screen / tmux
pkg install tmuxtmuxMultiple 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 lolcatfiglet "HACKER" | lolcatTerminal me bade colorful ASCII-art letters print karta hai — hacker-style intro banane ke liye popular trick.
.bashrc customization
nano ~/.bashrcYeh 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 htophtopLive me CPU, RAM aur running processes ka usage dikhata hai — Task Manager jaisa terminal version.
termux-boot (auto-start scripts)
pkg install termux-bootPhone 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 zshchsh -s zshDefault 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-widgetHome-screen par tap-to-run shortcuts banata hai apne ~/.shortcuts/ folder ke scripts ke liye.
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.txtgrep -ri "error" logfile.txtKisi 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.txtStream 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.txtColumns/fields wale data ko process karne ke liye powerful language — yaha har line ka pehla column print ho raha hai.
sort
sort file.txtsort -nr numbers.txtFile ki lines ko alphabetically sort karta hai. -n numeric sort, -r reverse order ke liye.
uniq
sort file.txt | uniqsort file.txt | uniq -cDuplicate (repeated) lines ko hata deta hai. -c se har unique line kitni baar aayi, uska count bhi milta hai.
wc
wc -l file.txtWord Count — file ki lines (-l), words (-w), ya characters (-c) ginta hai.
head / tail
head -n 10 file.txttail -f log.txtFile 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/passwdKisi 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.txtDo files ke beech ka difference (kaunsi lines alag hain) dikhata hai — code/config compare karne ke liye.
xargs
find . -name "*.log" | xargs rmEk 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.txtCommand ka output screen par bhi dikhata hai aur ek file me bhi save kar deta hai, same time par.
jq (JSON parsing)
pkg install jqcat 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.csvSpace/tab se separated text ko neat, aligned table jaisa format me terminal me print karta hai.
Process & System Management
Running programs (processes) ko dekhna, control karna aur system ki health check karne ke commands.
ps
ps auxAbhi kaunse processes/programs chal rahe hain, unki poori list (PID, CPU/memory usage sahit) dikhata hai.
kill
kill 1234kill -9 1234Process ID (PID) se kisi program ko force-stop karta hai. -9 se turant/forcefully band hota hai.
pkill / pgrep
pkill nodePID 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
jobscommand &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 -hRAM ka total, used aur free memory human-readable format (GB/MB) me dikhata hai.
uptime
uptimeDevice/session kitni der se on/running hai, aur average system load dikhata hai.
termux-info
termux-infoTermux version, Android version, architecture jaisi puri debug-info ek saath dikhata hai — bug-report share karte waqt useful.
id / groups
idCurrent user ka user-ID, group-ID aur konse groups me hai, yeh dikhata hai.
watch
pkg install procpswatch -n 2 free -hKisi command ko har kuch second (yaha 2 sec) me automatically re-run karke live output dikhata hai.
termux-chroot / tsu
pkg install tsudoRooted devices par root-level access (superuser) commands chalane ke liye — non-rooted phones par kaam nahi karta.
time
time ls -laKoi bhi command chalane me kitna time laga, wo measure karke dikhata hai — scripts optimize karne ke liye useful.
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 initCurrent 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.gitGitHub/GitLab par maujood kisi bhi repository ko poori history ke saath apne device me download karta hai.
git status
git statusBatata hai ki kaunsi files change hui hain, kaunsi staged hain, aur kaunsi track hi nahi ho rahi.
git add
git add file.txtgit 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 mainApne local commits ko remote server (GitHub) par upload karta hai.
git pull
git pull origin mainRemote repository me hue latest changes ko apne local folder me download/merge karta hai.
git branch
git branchgit branch new-featureExisting 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-nameEk branch se doosre branch me switch karta hai.
git log
git log --onelineAb tak ke saare commits ki history dikhata hai — --oneline se compact, ek-line format me.
git diff
git diffLast commit ke muqable abhi files me kya-kya exact changes hue hain, line-by-line dikhata hai.
git stash
git stashgit stash popIncomplete 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-nameEk branch ke changes ko doosre branch me combine (merge) karta hai.
git reset
git reset --hard HEAD~1Last commit ko poori tarah undo kar deta hai — ise dhyan se use karo, changes permanently khatam ho jaate hain.
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 vimvim file.txtVim install karke kisi file ko open karta hai. Vim me 2 modes hote hain — Normal (commands) aur Insert (typing).
i (insert mode)
iNormal mode se Insert mode me jaata hai, tabhi text type kar sakte ho. Bahar aane ke liye Esc dabao.
:w (save)
:wNormal 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)
:wqFile ko save karke turant Vim se bahar bhi nikal jaata hai — sabse common exit command.
dd (delete line)
ddNormal mode me cursor jis line par hai, poori line delete kar deta hai.
yy / p (copy-paste)
yypyy se current line copy (yank) hoti hai, p se usko cursor ke neeche paste karte hain.
/search
/keywordFile ke andar kisi word ko search karta hai. n dabakar next match par jump karo.
u (undo)
uLast change ko undo karta hai — galti se kuch delete/change ho gaya ho to isse wapas laa sakte ho.
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/bashHar 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.shEk 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 $PATHSystem 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"; fiScripts 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; doneSame command ko multiple values par baar-baar repeat karta hai.
while loop
while true; do echo "running"; sleep 1; doneEk 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: " nameScript 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 worldScript ko command-line se diye gaye arguments $1, $2 variables ke through script ke andar access hote hain.
sleep
sleep 5Script/terminal ko diye gaye seconds tak pause (wait) karta hai.
source / . (dot)
source ~/.bashrcKisi 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.
Compression & Archives
Files/folders ko compress karke storage bachane aur transfer karne ke commands.
gzip / gunzip
gzip file.txtgunzip file.txt.gzSingle file ko .gz format me compress/decompress karta hai — original file ki jagah compressed file ban jaati hai.
bzip2 / bunzip2
pkg install bzip2bzip2 file.txtgzip jaisa hi, par thoda better compression ratio deta hai (par speed thodi slow hoti hai).
7z (7-zip)
pkg install p7zip7z 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 unrarunrar x file.rar.rar format ki archives ko extract karta hai — Windows se aayi files ke liye common.
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-dlpyt-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 ffmpegffmpeg -i input.mp4 output.mp3Video/audio convert, trim, merge, compress karne ka industry-standard tool — yaha video ko audio(mp3) me convert kar raha hai.
imagemagick (convert)
pkg install imagemagickconvert photo.png photo.jpgImages ka format convert karna, resize karna, ya batch-edit karna — terminal se hi image editing ka powerful tool.
cmus (music player)
pkg install cmuscmusTerminal ke andar hi ek lightweight music player chalata hai — apni ~/storage/music folder ki songs play karne ke liye.
mpv (video player)
pkg install mpvmpv video.mp4Lightweight command-line video/audio player, streaming URLs bhi directly play kar sakta hai.
qrencode
pkg install qrencodeqrencode -o code.png "Hello"Kisi bhi text/URL ka QR code image bana deta hai terminal se hi.
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.