NewssecurityTermux

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:

Uses of Termux
  • 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:

Termux App
Termux App

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.

List of Termux or Termux commands

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:

CommandDescription
apt updateUpdates the list of available packages.
apt upgradeUpdates 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-allDisplays 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:

CommandDescription
apt updateUpdates the list of packages available on the system.
apt upgradeUpdates 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:

CommandDescription
lsLists all directories and files in the current working directory.
ls -aLists all files and folders, including hidden files and folders, in Termux.
ls ~Lists all files and folders in the home directory.
ls -lShows file attributes such as modification, date and time, file owner, permissions, and more.
cpUsed to copy a file to another directory.
mvUsed to move a file or folder to another directory.
pwdDisplays the current working directory.
touchUsed to create a file in Termux.
apt updateUpdates packages.
pkg install slChecks if a program is installed correctly.

Termux Activation Commands

To activate some of the Termux capabilities, you can use the following Termux commands:

CommandDescription
termux-battery-statusDisplays the battery status of your device.
termux-sms-inboxDisplays your SMS inbox.
termux-contact-listDisplays your list of contacts.
termux-camera-photoTakes 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:

CommandDescription
lsThe “ls” command is used to list all directories and files in the working folder/directory.
cdChange the working directory.
pwdThe “pwd” command is used to display the current working directory.
cpCopy a file to another directory.
mvMove a file or directory to another directory.
rmDelete a file.
mkdirCreate a new directory.
rmdirDelete an empty directory.
catDisplay the contents of a file.
nanoEdit a file with the nano editor.
vimEdit a file with the Vim editor.
apt updateUpdate the list of packages.
pkg installInstall packages.
pkg uninstallRemove packages.
pkg searchSearch for packages.
pkg list-allList all packages.
pip installInstall packages in Python.
pip uninstallRemove packages in Python.
git cloneCopy a group of files from a git repository to your local machine.
git pullUpdate the contents of a git repository with the latest changes from the remote git repository.
`wget -O- URLsh`
curl -O URLDownload a file.
`curl -O URLsh`
whoamiDisplay the username you are logged in as.
uname -aDisplay system information.
helpThe help command displays all system-level commands for the Termux application.
pingTest the connection to a service or server.
pkg reinstallThe pkg reinstall Command is used to reinstall the specified installed packages with their latest versions.
findThe find command is used to find files in Termux.
pkg autocleanThe pkg autoclean command is used to remove the cache of old packages.
pkg cleanThe command to clean pkg is used to delete all packages from the .deb package cache.
pkg filesThe “pkg files” command is used to display all the files installed by packages.
pkg showThe pkg show command is used to display basic metadata such as dependencies, etc.
pkg uninstallThe command “pkg uninstall” is used to remove the specified packages.
toptop is a Termux command for displaying all background processes. It shows all activities and background processes in the terminal.
historyThe history command is used to view all previously executed commands.
aliasIt allows you to create an alias for a specific long command that can help you in easily performing repetitive operations.
exitIt enables you to easily exit the Termux terminal.
df -hThe 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.
uptimeThe uptime command shows you the uptime of your Android device.
curlcurl is one of the most important Termux commands that allows you to send an HTTP request to a given URL.
envThe 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“.

keleis andre

Keleis Andre is A tech writer specialising in cybersecurity expert, author, and Manager at SPY24 Company. On this and several other GDPR, MDR, and ethical hacking projects. Hacking, Social Engineering, and Security Awareness Training: My goal is to educate, inform and entertain as I write about my journeys in the tech and cyber space.

Leave a Reply

Your email address will not be published. Required fields are marked *