Termux: A Complete Guide for Beginners
Termux is a powerful terminal emulator and Linux environment for Android. It allows users to run command-line tools and applications on their Android devices without rooting. Whether you're a developer, ethical hacker, or just a tech enthusiast, Termux provides a full-fledged Linux experience right in your pocket.In this blog, we'll cover:
What Termux is and why it's useful
Basic Termux commands
Package management
File operations
Networking tools
Scripting in Termux
Useful tips and tricks
1. What is Termux?
Termux is an Android terminal emulator that provides a Linux-like environment. It comes with its own package manager (pkg
and apt
) and supports thousands of command-line tools, programming languages, and utilities.
Why Use Termux?
Run Linux commands on Android
Develop and run Python, Bash, C, and other scripts
Use networking tools like
nmap
,curl
,wget
SSH into remote servers
Ethical hacking and penetration testing (with tools like Metasploit)
Learn Linux commands without needing a PC
2. Getting Started with Termux
Installation
Download Termux from:
F-Droid (Recommended)
Google Play Store (May be outdated)
Basic Setup
After installation, run these commands to update packages:
pkg update && pkg upgrade
3. Basic Termux Commands
Here are some essential commands to get started:
Navigation Commands
Command | Description |
---|---|
pwd | Print current working directory |
ls | List files and directories |
cd [directory] | Change directory |
cd .. | Move to parent directory |
cd ~ | Go to home directory |
mkdir [name] | Create a new directory |
rmdir [name] | Remove an empty directory |
File Operations
Command | Description |
---|---|
touch [file] | Create a new file |
cat [file] | Display file content |
nano [file] | Edit file using Nano editor |
cp [source] [destination] | Copy a file |
mv [source] [destination] | Move or rename a file |
rm [file] | Delete a file |
rm -rf [directory] | Force delete a directory |
System Information
Command | Description |
---|---|
uname -a | Show system information |
whoami | Display current user |
df -h | Show disk space usage |
top | Display running processes |
ps | List active processes |
4. Package Management
Termux uses pkg
(a wrapper for apt
) to install packages.
Basic Package Commands
pkg update # Update package list pkg upgrade # Upgrade all installed packages pkg install [package] # Install a package (e.g., `pkg install python`) pkg remove [package] # Uninstall a package pkg search [keyword] # Search for packages pkg list-installed # List installed packages
Popular Packages to Install
pkg install python # Python programming pkg install git # Git version control pkg install wget # Download files pkg install curl # Transfer data via URLs pkg install nmap # Network scanning pkg install vim # Advanced text editor
5. Networking in Termux
Termux includes many networking tools:
Basic Networking Commands
ping google.com # Check internet connectivity ifconfig # Network interface info (requires `net-tools`) wget [URL] # Download a file curl [URL] # Fetch URL content ssh user@host # Connect via SSH
Setting Up an SSH Server
Install OpenSSH:
pkg install openssh
Start SSH server:
sshd
Find your IP:
ifconfig
Connect from another device:
ssh [username]@[your-ip] -p 8022
6. Scripting in Termux
You can write and execute scripts in Termux using Bash or Python.
Creating a Simple Bash Script
Create a file:
nano hello.sh
Add the following:
#!/bin/bash echo "Hello, Termux!"
Save (
Ctrl+O
) and exit (Ctrl+X
).Make it executable:
chmod +x hello.sh
Run it:
./hello.sh
Running Python Scripts
Install Python:
pkg install python
Create a Python script:
nano hello.py
Add:
print("Hello from Python!")
Run it:
python hello.py
7. Useful Termux Tips & Tricks
Storage Access: Run
termux-setup-storage
to grant Termux access to device storage.Customize Prompt: Edit
~/.bashrc
to change the terminal appearance.Run GUI Apps: Use Termux:X11 add-on for GUI applications.
Run Linux Distributions: Install proot-distro to run Ubuntu, Debian, etc.
pkg install proot-distro proot-distro install ubuntu proot-distro login ubuntu
Conclusion
Termux is a versatile tool that brings the power of Linux to Android. Whether you're learning command-line basics, coding on the go, or performing network security tasks, Termux has you covered. Start exploring and unlock the full potential of your Android device!
Next Steps
Try installing more packages (
pkg list-all
)Learn Bash scripting
Experiment with networking tools like
nmap
andnetcat
Happy hacking with Termux! 🚀
No comments:
Post a Comment