This post is about the Termux commands list and gives you an overview of how to use the basic commands for Termux to perform basic tasks.
With the help of Termux, you can easily install the applications that run on the Linux platform via the APT package manager. Some of the best tools for Termux are Metasploit, Tool-X, SQLMap, XploitSpy, Wireshark, Fsociety, and many more. There are two package managers available in Termux. The first is "apt" and another is "pkg" You can install any app that is available for Termux with the help of these package managers. If you are bored with Termux, you must try some Termux alternatives.
Now let's see what are the uses of Termux. So Termux can be used for improving security and in Ethical hacking. Through Termux, you can easily secure your Wi-Fi or a web application by performing penetration testing and many more things. If you are already an expert in Termux, here are some of the best Termux tools for you. If you don't have Termux, you can install it from the below links:
What are Termux Commands?
The commands used in Termux are similar to Linux shell commands. Just like you would type commands in a Linux terminal to perform tasks, you can type the same or similar commands in the Termux terminal to achieve the same results.
For example, Linux commands like ls, cp, mv, rm, mkdir, etc all work in Termux. So if you want to list files and directories, you can use 'ls'. To copy files, you can use 'cp' and so on.
Termux commands allow you to access the Linux environment on your mobile device. You can install additional Linux packages, edit files, run scripts, work with the filesystem, and do many other tasks through these Terminal commands.
So in summary, Termux commands are terminal commands similar to Linux shell commands, which you can use within the Termux app to access Linux functionality and perform various tasks on your Android device. If you know common Linux/Unix commands, you can easily use Termux.
Termux commands list for Package management
Here is the list of Termux Commands:
List of Termux Commands | Uses of Termux Commands |
---|---|
pkg search PACKAGE NAME HERE | Allows you to search for a particular package. |
pkg install PACKAGE NAME HERE | Install a package. |
pkg uninstall PACKAGE NAME HERE | uninstall a package. |
pkg reinstall PACKAGE NAME HERE | Reinstall a package. |
pkg show PACKAGE NAME HERE | Get detailed information about the package. |
pkg-list-installed |
List installed Termux package. |
pkg-list-all |
List all available packages for Termux. |
pkg autoclean |
Removes packages that are not longer needed. |
pkg clean | Clean up the local cache of packages downloaded from remote repositories. |
pkg files PACKAGE NAME HERE | Shows the location of the files. |
pkg update | Update the Termux packages. |
pkg upgrade | Upgrade the Termux packages. |
pkg update && pkg upgrade -y | Update and Upgrade the Termux packages. |
List of Termux basic shell commands
List of Termux Commands | Uses of Termux Commands |
---|---|
history | Shows the history of previously typed commands. |
cal | Shows Calander. |
date | Shows the current date. |
help | Displays information about shell built-in commands. |
exit | Use this command to close the Termux. |
uptime | Shows the uptime of your operating system. |
df | Displays the amount of disk space available on the file system. |
find | Search for files in a directory hierarchy. |
su | Change your user ID or become a 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. |
List of Termux commands for File Management
List of Termux Commands | Uses of Termux Commands |
---|---|
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 list
List of Termux Commands | Uses of Termux Commands |
---|---|
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. |
A detailed description of Termux Commands List
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 of basic Termux commands.
Search for package:
pkg search command is used to search for a particular package. You can use the pkg search command to search for Termux packages
pkg search package name
For example:
pkg search metasploit
Install package
The pkg install command 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 command is used to uninstall a package or a tool. You can easily uninstall any package from your Termux with this command.
pkg uninstall package name
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 command will first uninstall and then install the package back again to your Termux
pkg reinstall package name
pkg reinstall metasploit
Get detailed info about the package
pkg show command is generally used to show detailed information about a particular package. Use this command to get detailed information about the package.
pkg show package name
pkg show package name
List installed Termux packages
Use this command to get the list of all packages that are currently installed in your Termux.
pkg-list-installed
List all Termux packages
pkg list-all command is used to get a list of all available packages for the Termux. Use this command 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. The command with an example is shown below:
pkg files package name
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 command will get executed, and then the pkg upgrade command will get executed. -y is used to prompt yes.
In simple words, this Termux command will update and upgrade your Termux packages.
pkg update && pkg upgrade -y
Clear Termux screen
Use this command to clear the Termux screen
clear
Print the current working directory
Use this Termux command 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 command to change the directory. You can easily move from one directory to another by using this command. The example is given below.
cd $HOMEcd /sdcard
The first command will take you to the Termux home directory, while another command 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 Termux command to see the files and folders that are present in the current directory.
ls
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 command 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 command 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
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
Zip command
zip is the popular command of the Termux. The Zip command is used to compress and decompress a particular file or folder.
zip FILE NAME HERE
unzip FILE NAME HERE
pkg install zip
Create and remove the directory
mkdir command is used to make directories, while rmdir Termux command 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
mkdir Termux
df command
Shows the size of the object in the specified folder.
df Termux
Exit The Termux
Use this command 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 Termux command:
open readme.txt
ping command
The command 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 command to show the calendar.
cal
Show date
Use this command to print the date.
date
History of command
Use this Termux command to see the history of the Termux commands that you had typed before.
history
Download file from Termux
The wget Termux command 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 command
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
pkg install git
If you want to know Termux in detail, you can read our below article:
Below is the video on the Termux command list and How to use Termux basic commands:
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:
Also Read - Best Hacking Apps for Android.
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 Termux 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
If you are still confused about how to configure the Termux properly, You can see the below video from our YouTube channel.
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.
Termux command to 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.
Termux command to install wget tool:
pkg install wget
Installing Zip
The Zip command is used to compress or decompress any file. Zip commands come preinstalled in most of Linux distributions, But in Termux, you have to install the zip command manually.
Install the zip:
pkg install zip
Wrapping Up
So Above is the list of best Termux commands for beginners. You must learn all these commands to properly run the Termux without getting any errors. After learning all the Termux commands, you must try some Termux scripts. I hope this article is helpful to you.