Termux Basic Commands for Beginners: Learn How to Use Termux Like a Pro

Learn all the basic Termux commands step-by-step. This beginner-friendly guide will help you understand how to use Termux efficiently on Android.

Termux is a powerful terminal emulator for Android that gives you access to a Linux shell right on your phone. It’s useful for programming, penetration testing, and learning Linux. But for beginners, the command-line interface can feel scary.

Don’t worry. In this post, I’ll teach you all the important basic Termux commands in a simple and clear way. This guide is perfect for beginners who want to use Termux like a pro.

Termux Basic Commands banner featuring a terminal symbol with a Kali Linux dragon, labeled Termux Basics and branded with Kalimux in the corner.

What is Termux?

Termux is a free and open-source terminal emulator that allows you to run Linux commands on Android. Unlike other terminal apps, Termux doesn’t need root access. It supports packages like git, python, nmap, curl, openssl, and even tools used in ethical hacking.

Before You Start

After installing Termux from F-Droid or GitHub, the first thing you should do is update your package list:

pkg update && pkg upgrade

This keeps your Termux environment stable and up-to-date.

Basic Termux Commands with Explanations

1. Update & Upgrade Packages

pkg update && pkg upgrade

This command refreshes the package list and installs available updates.

2. Install a Package

pkg install git

Installs a package. You can replace git with any other tool like python, curl, or vim.

3. Access Internal Storage

termux-setup-storage

Allows Termux to access files in your device’s storage. You must grant permission manually after this command.

4. Create a New Directory

mkdir test

Creates a new folder named “test”.

5. List Files and Folders

ls

Shows files in the current directory. Use ls -la to view hidden files too.

6. Change Directory

cd foldername

Moves into a folder. Use cd .. to go back one level, and cd to return to home.

7. Create a File

touch file.txt

Creates a new empty file named “file.txt”.

8. View File Content

cat file.txt

Displays the contents of the file.

9. Edit a File

nano file.txt

Opens the file in the nano text editor inside Termux. Press CTRL + X to exit after editing.

10. Delete a File or Folder

rm file.txt
rm -rf foldername

The first removes a file, the second deletes a folder and everything inside it.

11. Move or Rename Files

mv old.txt new.txt

Renames the file. You can also use this to move files to another directory.

12. Copy Files

cp file.txt /sdcard/

Copies a file to your phone’s internal storage.

13. Check Your Location (Current Path)

pwd

Prints your current working directory.

14. Clear the Terminal

clear

Wipes the terminal screen.

15. Exit Termux

exit

Closes the terminal session.

16. Download a File

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

Downloads a file from the internet.

17. Check Package Information

pkg show python

Shows info about a package, like version and dependencies.

18. Search for Packages

pkg search package-name

Finds packages related to your search term.

19. Display Calendar

cal

Shows the current month calendar inside Termux.

20. Show Current Date and Time

date

Displays the current date and time.


Termux Basic Command Table

Command Description
pkg update Updates package list
pkg upgrade Upgrades installed packages
pkg install packagename Installs a package
ls Lists files and directories
cd folder Changes directory
touch file.txt Creates a file
cat file.txt Views file content
rm file.txt Deletes a file
mv old.txt new.txt Renames a file
pwd Shows current path
clear Clears terminal screen
exit Closes Termux

Pro Tip: Combine Multiple Commands

You can join commands using && to save time. Example:

pkg update && pkg upgrade && clear

This will update, upgrade, and clear the terminal in one go.

Final Thoughts

Termux may look difficult at first, but with practice, it becomes easy. These basic commands are the building blocks of everything you’ll do in Termux. Whether you’re learning Linux, coding in Python, or installing hacking tools, these commands are always useful.

If this guide helped you, consider bookmarking it or sharing it with your friends who are also new to Termux. And stay tuned for more Termux guides and tutorials on my blog!

إرسال تعليق