📱 Termux Guide – Turn Your Android into a Linux Powerhouse
Imagine running Python, hosting a web server, or even using Git – all from your Android phone. With Termux, you can do exactly that. Termux is a free, open‑source terminal emulator and Linux environment that runs directly on your Android device without root. In this guide, I’ll show you how to install it, master the basics, and unlock its full potential.
1. What is Termux and Why Should You Use It?
Termux brings a lightweight Linux environment to your pocket. It includes a package manager (pkg) that lets you install hundreds of tools: Python, Node.js, Git, SSH, Vim, and much more. You can use it to:
- Learn Linux commands without a PC
- Write and run Python/JavaScript code on the go
- Host a simple HTTP server or Telegram bot
- Connect to remote servers via SSH
- Automate tasks with shell scripts
- Practice ethical hacking tools (with care)
It’s a full development environment that fits in your pocket – and it’s completely free.
2. Installing Termux
You can’t download Termux from the Play Store anymore (it's outdated there). Install it from F‑Droid, the open‑source app store:
- Download and install F‑Droid from f-droid.org.
- Open F‑Droid, search for Termux, and install it.
- Launch Termux – you’ll see a black terminal with a blinking cursor. That’s your new Linux playground.
Once installed, I recommend running:
pkg update && pkg upgrade
This updates the package lists and all installed packages to their latest versions.
3. Basic Termux Commands (That You’ll Use Every Day)
The commands are identical to a desktop Linux terminal. Start with these:
pwd # Print Working Directory (where you are) ls # List files and folders cd storage # Change directory to the internal storage mkdir myproj # Create a new directory named "myproj" touch hello.txt # Create an empty file cat hello.txt # Display the contents of the file rm hello.txt # Delete the file (be careful!) clear # Clear the terminal screen
4. Accessing Your Phone’s Storage
By default, Termux works inside its own private folder. To access your photos, downloads, and other files, give it storage permission:
termux-setup-storage
After granting permission, you’ll see a storage folder inside your home directory. You can now read and write files anywhere on your internal storage.
5. Installing Packages – Python, Git, and More
Termux uses pkg (a wrapper for apt) to install software. For example, to install Python:
pkg install python
After installation, type python to launch the interactive shell. Press Ctrl+D to exit.
Some essential packages for development:
pkg install git # Version control pkg install nodejs # Node.js and npm pkg install vim # Text editor pkg install openssh # SSH client/server pkg install wget curl # Download files pkg install php # PHP runtime pkg install mariadb # MySQL‑compatible database
6. Running a Simple HTTP Server
With Python installed, you can start a basic web server in any directory:
cd ~/my-website python -m http.server 8080
Open your phone’s browser and go to http://localhost:8080. You’ll see your files served as a website. (Use Ctrl+C to stop the server.)
For a more serious web server, you can install Apache or Nginx:
pkg install nginx nginx
7. Using SSH – Connect to Remote Servers
Termux can act as an SSH client, allowing you to manage your VPS or cloud server right from your phone:
ssh username@your-server-ip
You can even run an SSH server on your phone to access it from a computer:
pkg install openssh sshd # Set a password first: passwd
8. Writing and Running Scripts
Create a shell script with vim or nano:
echo 'echo "Hello from Termux!"' > hello.sh chmod +x hello.sh ./hello.sh
You can automate backups, start bots, or even schedule tasks with cronie (a cron replacement).
9. Customizing Termux – The Extra Mile
- Install the Termux:Float add‑on – Use the terminal in a floating window while doing other tasks.
- Use the Termux:API add‑on – Access phone sensors, battery, clipboard, and more from scripts.
- Install
zshandoh-my-zsh– Make your terminal colorful and productive with auto‑suggestions. - Use
tmux– Run multiple terminal sessions in one window and keep programs alive in the background.
10. Common Problems and Fixes
- “command not found” – You need to install that package first.
- Storage permission not working – Run
termux-setup-storageagain and grant the permission. - Battery optimization killing Termux – Disable battery optimization for Termux in your phone settings.
- Screen goes black – Increase screen timeout or use “Keep screen on” apps.
🚀 Want to Go Deeper with Linux?
Termux is your gateway to the Linux world. Once you’re comfortable, try our full Ubuntu guide.
Start Ubuntu Guide →Final Thoughts
Termux transforms your phone into a portable Linux lab. Whether you’re learning programming, managing servers, or just tinkering, the skills you build with Termux apply directly to real‑world IT jobs. Best of all – it’s free, open‑source, and always in your pocket.