Termux Commands List for Beginners

As a Linux expert, I’ve curated a comprehensive list of Termux commands that beginners will find useful for navigating and managing their systems.
In the realm of mobile devices, Termux is a powerful terminal emulator and Linux environment app that allows users to access and manage their Android device in ways they never thought possible. It’s like having a Linux distribution in your pocket, ready to be used whenever you need it.

This article aims to provide a comprehensive list of Termux commands, from the most basic to the most advanced. Whether you’re a beginner just starting out with Termux or an experienced user looking to expand your knowledge, this guide is designed to help you navigate the powerful capabilities of Termux with ease.

We’ll start with the basics, introducing you to the command line interface and the fundamental commands that make Termux tick. Then, we’ll delve into more advanced topics, exploring the power of shell scripting, package management, and even network troubleshooting.

So, whether you’re looking to automate tasks, run servers, or simply use your Android device more effectively, this guide to Termux commands is your go-to resource. Let’s embark on this journey together, unlocking the full potential of your Android device with Termux.

Termux commands for Package management

Termux-commands-list

Termux Commands Uses
pkg search PACKAGE NAME HERE Search for a specific package.
pkg install PACKAGE NAME HERE Install a package.
pkg uninstall PACKAGE NAME HERE Remove a package.
pkg reinstall PACKAGE NAME HERE Reinstall a package.
pkg show PACKAGE NAME HERE Get detailed information about the package.
pkg-list-installed
View installed Termux packages.
pkg-list-all
See all available packages for Termux.
pkg autoclean
Remove unneeded packages.
pkg clean Clear the local cache of downloaded packages.
pkg files PACKAGE NAME HERE Shows the location of the files.
pkg update Update Termux packages.
pkg upgrade Upgrade Termux packages.
pkg update && pkg upgrade -y Update and Upgrade the Termux packages.

Termux basic shell commands


Termux Commands Uses
history View previously typed commands.
cal Display the calendar.
date Shows the current date.
help Get information about shell built-in commands.
exit Close Termux.
uptime Show system uptime.
df Display available disk space.
find Search for files.
su Change user ID or become superuser.
echo Write arguments to the standard output.
passwd Change the user's password. If no user is specified, change the password for the current user.
du Summarize disk space used for each FILE and/or directory.
whoami Displays user, group, and privileges information for the user who is currently logged on to the local system.
ifconfig Configure network interface parameters.
ping Send ICMP ECHO_REQUEST to network hosts.
netstat Print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships.
sleep Suspends program execution for a specified time.

Termux commands for File Management


Termux Commands Uses
ls List information about files and directories within the file system.
touch FILENAME Create a new file.
cat FILENAME cat command is used to display the contents of a file.
cp cp command is used to create a copy of a file.
mv mv command is used to move a file from source to destination.
rm FILENAME delete a file
rm -rf DIRECTORY NAME Force delete the given directory.
mkdir NEW DIRECTORY NAME Create a new directory.
rmdir DIRECTORY NAME Remove a directory.
cd DIRECTORY NAME Change the directory.
pwd Prints the current working directory.
chmod 777 FILENAME Modify the permission of the file. Anyone can read, write, and execute the file.

Some additional Termux commands


Termux Commands Uses
zip FILENAME Compress a file.
unzip FILENAME Decompress a file.
wget URL HERE Download a file from the web.
git clone URL OF GITHUB HERE Clone the packages from Github to your system.
env Allows you to display your current environment or run a specified command in a changed environment.
termux-setup-storage Grant Termux to access the device storage.

Detailed description of the Termux Commands

You need to master these Termux commands because they are very useful in terms of operating the Termux. Without knowing commands, You will not be able to use the Termux. These commands will often be used to install and manage applications, files, folders, and many more. You can also check the list of Best Termux packages.

Here is a detailed description:

Search for package:

pkg search is used to search for a particular package. You can use the pkg search to search for Termux packages

pkg search package name

For example:

pkg search metasploit

Install package

The pkg install installs Termux packages that are not currently installed and updates packages that are already installed.

pkg install package name

For example:

pkg install metasploit

By using the above command, Metasploit will be installed. If you want to install another package, then remove the Metasploit and then type the name of your own package.

Uninstall package

The Uninstall package, is used to uninstall a package or a tool.

pkg uninstall package name

Example:

pkg uninstall metasploit

By typing the above command, Metasploit will be uninstalled.

Reinstall a package in Termux

If you want to reinstall the Termux packages to the same versions as were previously installed, then you can use this command. The pkg reinstall will first uninstall and then install the package back again to your Termux

pkg reinstall package name

For Example:

pkg reinstall metasploit

Get detailed info about the package

pkg show is generally used to show detailed information about a particular package. Use it to get detailed information about the package.

pkg show package name

For Example:

pkg show package name

List installed Termux packages

Use this to get the list of all packages that are currently installed in your Termux.

pkg-list-installed

List all Termux packages

pkg list-all is used to get a list of all available packages for the Termux. Use this  to see the list of all available packages.

pkg list-all

Show the location of files

pkg files used to show the location of installed files and packages in the Termux.

pkg files package name

For Example:

pkg files metasploit

Update and Upgrade Termux packages

pkg update && pkg upgrade -y is the mixture of two commands separated by &&. You can use multiple commands in Termux by adding && to the Termux.

First, the pkg update will get executed, and then the pkg upgrade will get executed. -y is used to prompt yes.

In simple words, this It will update and upgrade your Termux packages.

pkg update && pkg upgrade -y 

Clear Termux screen

Use this to clear the Termux screen

clear

Print the current working directory

Use this to print the working directory, That means the command will give you a location of the current directory in which you are present.

pwd

Change directory

You can use this to change the directory. You can easily move from one directory to another by using this command. The example is given below.

cd $HOME

cd /sdcard

The first command will take you to the Termux home directory, while another will take you to the SD card of your Android device.

Going back to the directory

cd ..

cd ../../

See the files and folder of the current directory

Use this to see the files and folders that are present in the current directory.

ls

You can also use this to see more information about the files and folders including hidden files.

ls -lha

Copy files - cp

cp is used to copy the file from one directory to another. For example, I have a file that is present on the SD card, and the name of the file is "document".  If I want to move that document to the Termux home directory, then the following command will be used:

cp /sdcard/document $HOME

Move files - mv

mv is used to copy files from one folder to another. The procedure is the same as the above command just use mv instead of cp if you want to move the file.

Delete files and folder

rm is used to delete files in the directory or a folder. rm -rf used to delete the folder and its content. For example, if I want to delete a folder named "Document", then I will use the following command to delete that folder.

rm -rf Document

Change permission of file and folder

chmod is used to change the permission of the file and folder. Sometimes some files have only permission to read. To change the permission of a file from reading to read write and execute, we will use the following command:

chmod +x FILE NAME HERE

Or

chmod +x FILE NAME HERE

Read or create a file

To read any text, HTML, python file, etc cat command is used. For example, if I want to read the content of "document.txt", Then I will use the following command:

cat document.txt

Please note that if the file is not present at the given destination. Then the document.txt file will be created.

Zip

zip is the popular command of the Termux. The Zip is used to compress and decompress a particular file or folder.

To compress a file, the following command will be used:

zip FILE NAME HERE

To decompress a file, the following command will be used:

unzip FILE NAME HERE

Note: To use the zip and unzip, you will need to install the zip by typing the following Termux command.

pkg install zip

Create and remove the directory

mkdir is used to make directories, while rmdir is used to remove directories.

For example, I want to create a directory/folder named Termux, then I will use the following command:

mkdir Termux

To remove the Termux directory, the following command will be used:

mkdir Termux

df

Shows the size of the object in the specified folder.
df Termux

Exit The Termux

Use this to close the Termux.

exit

Open a file

Open the file with the default application associated with it. For example, I want to open the "readme.txt" file. Then I will use the following command:

open readme.txt

ping

Ping is used to ping an IP address or a website to ensure the reachability of a device to a specific web or IP address. Example:

open google.com

Show calender

Use this to show the calendar.

cal

Show date

Use this to print the date.

date

History

Use it to see the history of the Termux commands that you had typed before.

history

Download file from Termux

The wget will let you download any file and Termux package from the URL. Usage of this command is mentioned below:

wget URL HERE

Wget package needs to be installed to use this command. You can install the wget by using the below command:

pkg install wget

Git clone

To clone the packages from Github, you will need a git clone command. Usage of this command is mentioned below:

git clone URL OF GITHUB HERE

To use the git clone, the git command must be installed in the Termux. You can install git by typing the below command.

pkg install git

If you want to know Termux in detail, you can read our below article:

What basic commands should I type After Installing Termux?

As you install Termux on your Android device, the Termux is not configured, and you can't install most of the packages from it. You must configure your Termux for better use by typing the following basic commands in Termux:


Installation of root repository

The below command will install the root repository in your Termux. After installing this repository, you can easily install packages that are present in the root repository.

pkg install root-repo

Installation of unstable repository

The below command will install the unstable repository in your Termux.  After installing this repository, you can easily install packages that are present in the unstable repository.

pkg install unstable-repo

Installation of x11 repository

The below command will install the x-11 repository in your Termux.  After installing this repository, you can easily install packages that are present in the x-11 repository.

pkg install x11-repo

Setup storage for Termux

The above command will allow the Termux to use your sd card storage. Most of the permission denied issues that you face while accessing the sd card will get fixed after typing this command.

termux-setup-storage

Some Important Termux tools and commands:

Here I listed great Termux commands and tools that you would like to install in your Termux. These Termux tools do not come pre-installed with the Termux.

Installing Python

Python comes preinstalled on most Linux distributions, But in Termux, you have to install the Python manually. Most of the Termux tools will need Python to run. So Python must be installed in your Termux. 

Install Python:

pkg install python

Installing Wget

Wget is a free GNU command-line utility tool used to download files from the internet. Through the wget tool, you can easily download any files from the internet to your Termux.

Install wget tool:

pkg install wget

Installing Zip

The Zip is used to compress or decompress any file. Zip come preinstalled in most of Linux distributions, But in Termux, you have to install the zip manually.

Install the zip:

pkg install zip

Wrapping Up

As we reach the end of this comprehensive guide, we’ve journeyed together through the fascinating world of Termux commands. From the basic commands that form the backbone of Termux, to the advanced commands that unlock its true power, we’ve covered it all.