Termux Commands: Beginner to Advanced {2024}
Termux is a terminal environment simulator software that is open-source and can be installed on Android devices. This software can also be used as a small Linux operating system and contains various tools that are usually seen in Linux desktop versions. You can use Termux to install and run various command-line-dependent programs. An interesting point is that installing Termux on Android does not require root access at all, and at the same time, you can even install a lightweight desktop graphical interface on Termux without hardware acceleration. However, your software interface might be a bit slow, and using it on small mobile screens might not be very easy.
Termux App is extremely popular among programmers and people who want to have access to Linux programs on their phones.
This software provides the closest experience to Linux that you can have on an Android mobile phone. Termux is well-optimized for small screens as well, and using it on mobile is very comfortable. The phone’s keyboard will change when working with Termux, and entering various essential symbols is easily done. Also, by using the key located on the top row of the keyboard on the screen, you can use its Auto-Completion feature as well. I also suggest that you read the article “How to install Python in Termux?“.
Uses of Termux
Some of the tasks you can perform using Termux include:
- Running Python scripts
- Software development
- Penetration testing
- Networking
- System
- System management
- Running Bash scripts
- Running command-line specific games
- Access to Vi editor
- Connecting via SSH
- Creating a Python virtual environment
- Designing programs that do not require a graphical environment.
- Installing additional packages using pip, npm, CPAN, gem, Tlmgr, and other similar package managers
- Performing all the tasks that the installed packages can do via the command line.
Installation steps of Termux on Android
You can use Google Play or similar trusted sites to install Termux on Android. Then run Termux. After running, you will be faced with a page similar to the opposite picture:
Download Termux from the Play Store:
https://play.google.com/store/apps/details?id=com.termux&pli=1
Download Termux from F-Droid:
https://f-droid.org/en/packages/com.termux/
Download Termux: API from F-Droid:
https://f-droid.org/en/packages/com.termux.api/
Download Termux: Styling from Play Store:
https://play.google.com/store/apps/details?id=com.termux.styling&hl=en_CA&gl=US
Download Termux: Styling from F-Droid:
https://f-droid.org/en/packages/com.termux.styling/
As mentioned, the Termux program is a Linux terminal simulator. So, if you have experience with Linux, you can easily execute Linux commands in Termux. Next, we will review some commonly used Termux commands together.
What are Termux commands?
Simply put, Termux commands are terminal instructions that are used for a specific task. These commands are similar to Linux commands.
List of Termux or Termux commands
Here, we have provided a list of Termux commands from beginner to advanced, along with their uses for you.
Activating storage access on Termux
To access different files on the Termux terminal or to save changes made in Termux, you must first determine the Termux storage location and then give this software permission to access the memory. You can use the following command to do this:
termux-setup-storage
Notes: In the opened window, click “Allow“.
After you have given Termux the various memory access permissions, you can see Termux files in the Shared folder in the internal memory of your Android device. If this folder does not exist, you can also create it manually. The complete path of this folder will usually be as follows:
/storage/emulated/0/shared
Installation and management of official Termux packages
After installing Termux and granting storage access, you can use the following code to update the current repositories of this software:
$ pkg upgrade
Now, you can install the packages you want using the command below:
$ pkg install <package_name>
In the end, you can execute the commands related to the installed package in the Termux terminal. This is exactly like executing various commands in the Linux operating system:
To search among the available and installable packages, you can also use Termux itself. To do this, search for the desired word using the command below:
$ pkg search <search_term>
In the above command, replace <search_term>
with your desired keyword. Also, you can access the list of all installable packages using the following command:
$ pkg list-all
Installing Deb packages using Termux on an Android phone
In addition to the mentioned items, you can also install some of the .deb packages from Ubuntu or Debian repositories that are compatible with your phone’s architecture, using Termux (nowadays, most mobile phones have aarch64 and aarch32 architectures). Keep in mind that some packages may not run on Termux, but generally, to install a .deb package on an Android phone, you should use the following command:
$ dpkg -i <deb_package_name>
To remove .deb packages that have been manually installed, simply write a line of code in the following format:
$ dpkg –remove <deb_package_name>
To list all the .deb packages that have been manually installed, you can use the following command:
$ dpkg –l
All .deb packages compatible with your phone can also be installed on Termux. However, if you intend to use unknown packages, it’s best to be very careful not to install suspicious packages on your phone.
Activating additional repositories on Termux
Furthermore, you can use additional repositories to install other packages. To find other repositories, visit this page and click on the repositories that have the term –packages at the end of their names. The command related to activating each package is available in its README file and is roughly similar to the command below:
$ pkg install <repository_name>
Some of the items we have tried and have successfully run on Termux are as follows:
$ pkg install x11-repo
$ pkg install game-repo
$ pkg install root-repo
$ pkg install unstable-repo
$ pkg install science-repo
Basic Termux Commands
Some of the basic Termux commands include the following:
Command | Description |
---|---|
apt update | Updates the list of available packages. |
apt upgrade | Updates all installed packages to the latest available versions. |
apt install [package name] | Downloads and installs the specified package. |
apt remove [package name] | Removes the specified package from your device. |
pkg list-all | Displays a list of all packages that are available for installation. |
Termux Basic Commands Cheat Sheet
Some of the basic Termux commands that you can get familiar with:
Command | Description |
---|---|
apt update | Updates the list of packages available on the system. |
apt upgrade | Updates the packages installed on the system. |
pkg install <package_name> | Installs the specified package. |
pkg uninstall <package_name> | Removes the specified package. |
cd <directory> | Changes the current directory to the specified directory. |
mkdir <directory> | Creates a new directory. |
rm <file> | Deletes the specified file. |
cp <source> <destination> | Copies a file from the source to the destination. |
mv <source> <destination> | Moves a file from the source to the destination. |
Table of Basic Termux Commands for Android
The list of Termux Android commands is as follows:
Command | Description |
---|---|
ls | Lists all directories and files in the current working directory. |
ls -a | Lists all files and folders, including hidden files and folders, in Termux. |
ls ~ | Lists all files and folders in the home directory. |
ls -l | Shows file attributes such as modification, date and time, file owner, permissions, and more. |
cp | Used to copy a file to another directory. |
mv | Used to move a file or folder to another directory. |
pwd | Displays the current working directory. |
touch | Used to create a file in Termux. |
apt update | Updates packages. |
pkg install sl | Checks if a program is installed correctly. |
Termux Activation Commands
To activate some of the Termux capabilities, you can use the following Termux commands:
Command | Description |
---|---|
termux-battery-status | Displays the battery status of your device. |
termux-sms-inbox | Displays your SMS inbox. |
termux-contact-list | Displays your list of contacts. |
termux-camera-photo | Takes a photo using your device’s camera. |
Table of Commands for Termux
Using Termux commands, you can utilize Linux tools on your Android mobile. The list of Termux commands is very extensive and broad, and it is not possible to mention all of them here, but we have brought some of them below along with descriptions:
Following, we have brought you a list of 30 Termux commands along with their descriptions:
Command | Description |
---|---|
ls | The “ls” command is used to list all directories and files in the working folder/directory. |
cd | Change the working directory. |
pwd | The “pwd” command is used to display the current working directory. |
cp | Copy a file to another directory. |
mv | Move a file or directory to another directory. |
rm | Delete a file. |
mkdir | Create a new directory. |
rmdir | Delete an empty directory. |
cat | Display the contents of a file. |
nano | Edit a file with the nano editor. |
vim | Edit a file with the Vim editor. |
apt update | Update the list of packages. |
pkg install | Install packages. |
pkg uninstall | Remove packages. |
pkg search | Search for packages. |
pkg list-all | List all packages. |
pip install | Install packages in Python. |
pip uninstall | Remove packages in Python. |
git clone | Copy a group of files from a git repository to your local machine. |
git pull | Update the contents of a git repository with the latest changes from the remote git repository. |
`wget -O- URL | sh` |
curl -O URL | Download a file. |
`curl -O URL | sh` |
whoami | Display the username you are logged in as. |
uname -a | Display system information. |
help | The help command displays all system-level commands for the Termux application. |
ping | Test the connection to a service or server. |
pkg reinstall | The pkg reinstall Command is used to reinstall the specified installed packages with their latest versions. |
find | The find command is used to find files in Termux. |
pkg autoclean | The pkg autoclean command is used to remove the cache of old packages. |
pkg clean | The command to clean pkg is used to delete all packages from the .deb package cache. |
pkg files | The “pkg files” command is used to display all the files installed by packages. |
pkg show | The pkg show command is used to display basic metadata such as dependencies, etc. |
pkg uninstall | The command “pkg uninstall” is used to remove the specified packages. |
top | top is a Termux command for displaying all background processes. It shows all activities and background processes in the terminal. |
history | The history command is used to view all previously executed commands. |
alias | It allows you to create an alias for a specific long command that can help you in easily performing repetitive operations. |
exit | It enables you to easily exit the Termux terminal. |
df -h | The df -h command is used to display the amount of storage space used. It shows how much storage space is remaining and how much has been used before. |
uptime | The uptime command shows you the uptime of your Android device. |
curl | curl is one of the most important Termux commands that allows you to send an HTTP request to a given URL. |
env | The env command helps you to create environment variables in Termux. |
Conclusion:
Termux is a simple application that allows you to access the Linux shell on your Android device. It’s not just a tool for hacking. Depending on the user’s computer knowledge, it may be used for other purposes as well. It’s true that hacking activities can be flexible with Termux.
Since Android is actually a version of Linux, you can use the Termux app to access the Linux shell of Android as if you were using a portable Linux computer.
I also suggest that you read the article “How to get Free Google Play Gift Card with Termux“.