What is Termux? Full Tutorial With complete Termux commands


Want to learn Termux for hacking? first, understand what is Termux and follow how to install applications using Termux and the complete Termux command.

In this article, I am going to give you detailed information and everything that you need to know about Termux. So Let's get started.

What is Termux?

What is Termux? Basically, Termux is a terminal emulator application for Android as well as a Linux environment that runs on Android without the need for rooting or special settings. Additional applications/packages are also available and can be installed using the APT package manager.

What distinguishes Termux from other terminal emulators is that Termux has set up such a way that the environment on Termux is the same as the Debian standard Linux environment.

Because the Android environment is different from the Linux environment in general so that in Thermux we can install packages/applications commonly used on Linux in general.

With features and environment adjustments like the above makes Termux very special because you can install Penetration Testing Tools (pen-testing tool) / hacking applications such as Metasploit and net hunter times on your Android phone using Termux.

Termux also provides a package manager (APT) to make it easier for you to find and install the packages needed from the software repository that Termux provides.

In a Linux distribution, a "package" refers to a compressed file archive that contains all the files that make up a particular application. The files are usually stored in packages according to the existing installation path. Common types of Linux packages such as .deb, .rpm, and .tgz 

Android is Linux 

We are getting to know Android first, which is your operating system to run the TERMUX application. Android is a Linux-based operating system that is made for touch screen devices and handheld devices such as the cellphone that you are currently using.

Android is made and developed by Google, Android is made from modifying the Linux kernel and other opensource applications. This variant of Android is also used on other types of mobile devices such as game consoles, digital cameras, attendance machines, smart TVs, and other electronic devices.

So the Android cellphone that you currently hold is a Linux. Linux is famous for its powerful reputation, OS server, internet life, and hacking.

Termux is a terminal emulator application

A terminal emulator is an application that provides a text-based interface (CLI) to access the shell

To make it easier to access the Linux shell (Shell CLI) from the GUI, a terminal emulator is created, with the terminal emulator you can access the console shell from the GUI shell you are currently using, so it's easier.

Termux is a terminal emulator for Android that allows users to access your Android Linux shell from the GUI.

Termux provides a Linux environment

The environment variable is the name of an object that contains data used by one or more applications. In short, this is a variable with a name and value.

The contents of the name of this variable can contain information on environment definitions in the system, for example, the location of executable files and file settings in a system, the default editor that must be used, or the local system settings.

Laymen might think this is not important, but this variable environment provides a fast and simple way to share settings/configurations of applications and processes on Linux.

Linux distro environment, in general, is different from the android environment, running Linux applications in different environments will cause errors, very basic differences between general Linux and android include:
  • Public folders such as / bin, / etc, / usr, / tmp and / var do not exist.
  • The android directory structure does not follow the standard rules of the Linux directory structure in general. For example, in general, Linux binary files exist in / bin while in android/system/bin.
  • In the standard / general Linux folder ($ HOME) is created for each user in / home/username (multi-user), while in the android folder ($ HOME) is in the subdirectory of the application, so each application has its own folder ($ HOME) -alone. So avoid storing important data in the folder ($ HOME) when using TERMUX, because this folder will be deleted if TERMUX is uninstalled.
  • Termux installs the package in the directory based on the $PREFIXenvironment variable definition (example: binaries are in $PREFIX/bin, and configuration files $PREFIX/etc). To view the contents of the $ PREFIX variable you can type echo $ PREFIX in your TERMUX terminal.
  • Shared libraries are installed at $ PREFIX/lib, which has been defined in the $ LD_LIBRARY_PATH variable. This might clash with the Android system binaries in / system/bin, which can force LD_LIBRARY_PATH to be removed before running the system binaries.
  • In addition to the different android file systems with Linux in general, TERMUX is run by a single user without root access (Each android application is run by the user himself), so running Linux commands on TERMUX will not affect other applications.
Running an application using a non-root user causes ports below 1024 to be unusable (to be able to use ports under 1024 on Linux it must be with the root user).

As a solution, many packages have been configured to use port values ​​above 1024 as default values ​​in the Android environment.

Access shell Linux with Termux

A shell is an interface used by users to interact with the operating system, generally a shell in the form of a Command-Line Interface (CLI) or a Graphical User Interface (GUI).

The type of shell that you use on your Android Linux mobile every day is a GUI shell because with a GUI shell everyone can use it easily.

While the intended shell on Linux is a Shell in the Command-Line Interface (CLI) version, not a GUI, even though Linux already has a desktop/graphics like your android but the desktop version of the GUI is not the shell in question, because if you want to use 100% of Linux potential you must access it through the CLI.

When using TERMUX you will access the CLI shell and are required to type the command/text as the only way to interact with your android Linux through the shell.

Termux Function

The main function of Termux is to access the Linux shell on your Android phone, besides that it also emulates the Debian Linux environment so it feels like you are using a Debian Linux shell when you use Termux.

Linux shell accessed from Termux can be used for several things depending on the needs and skills of its users, for example by programmers/developers used as an environment to test applications that are being developed while by security experts can be used as platforms or tools and hacking tools that are very portable.

Access Android Shell

Termux is one of the terminal emulator applications, the main function of Termux is to provide a text-based interface (command-line interface) to access the Android Linux shell from a graphical user interface.

What makes Termux special is that Thermux develops techniques so that standard Linux applications can be installed and run on Android and also provides its own software repository.

Development and experiment Environments

Termux is often used by application developers during the application creation process and is also used to test their applications, with Termux developers will be easier to debug and find the cause of errors in the applications they try because Termux provides access to the android shell.

To support the software developer TERMUX has provided many compilers such as Clang, Rust, Go, etc, and Interpreters such as Bash, Perl, Python, etc. You can check the Termux development environment Wiki

Hacking tool

In the past, if you wanted to hack you had to use a laptop that had a Linux operating system installed, with Termux you can directly use your cell phone as a hacking tool because Android is one of the Linux variants.

Termux provides software repositories, and there are already tools for hacking that you can use to facilitate testing/auditing of security systems such as hydra, Nmap, Metasploit, net hunter times, etc.
I do not teach hacking / cracking whether requested or not. REMEMBER !! Hacking without permission is illegal and can get you jailed. The above tool should be used only to test/audit the system to find security holes/bugs/vulnerabilities and patch it to improve the security system not to be used for the purpose of damaging or exploiting the system for its own benefit.
Be careful with "hacking tutorials using Termux" which are very suspicious where users are told to install applications/scripts that are unclear which ultimately makes your Android phone that was hacked. Most tutorials like that only clickbait/tricks and will not work in the real world. The smooth hacking tutorial using TERMUX only forces the user to install malware on your Android phone that can make your Android phone hit or broken.

How to install Termux on Android

Installation of Termux is very easy and the same as you install the android application in general.
  • open the google play store
  • type the keyword "Termux" in the search box and press search
  • after finding Termux tap on the install button
  • wait for the installation process to finish
  • after the installation process is complete you should find the TERMUX launcher on your home screen, just tap to open TERMUX on your android
After successfully installing the Termux, you should run the command apt update so that the database/list of packages on your cellphone is updated and matched to that of the Termux repository server and run the command apt upgrade to upgrade the package in your Termux.

If you face any problem in installing and configuring Termux. Then you can watch this video about how to install and configure Termux.

How to install applications in Termux

Termux has been modified in such a way that your Android phone can be installed on a variety of Linux applications, applications that can be installed via Termux have been included in the Termux software repository online.

To be able to search, download, and install packages (the term for applications in Linux) that you need easily you can use the APT package manager.

APT is a package manager that is used by Debian and its distributions to manage packages.

Termux Repository Software

Unlike Windows, Linux applications (packages) are distributed centrally through a special server (software repository) that is managed and overseen by a community or official organization such as the TERMUX team.

From the repository software server, you can search, download, and install the application packages that you need without the hassle of looking around.

Official Repository:

For a repository (package/application) to be categorized and included in the Official repository, the repository must provide a "build script" for cross-compilation purposes so that packages can be compiled on all supported devices.

While packages built on a device and then packaged using "termux-create-package" cannot be categorized and included in the official repository.

All repositories with build scripts on the github.com/termux repo are managed and verified by signature by an officer on the Termux team.

Visit https://github.com/termux to get the official repository list then read and follow the instructions on how to install each official repository.
Community Repository:

In addition to the Official repository / official repository managed by the TERMUX team, there is also a community repository which is a repository made by individuals.

You can even create and manage it if you are a developer and want to distribute the application/package that you made to the world, the concept is the same as PPA on Ubuntu Linux.

After you finish creating the application you can package the application using termux-apt-repo from the shell to become a repository and put it on Github as hosting. </ br>

It's important to know that Github has a limit of 100MB per file and if your repository exceeds 1GB, you will be reprimanded by GitHub to reduce the repository size.

So if you have a very large package you should use a different hosting and select hosting according to the type of file, for example, video files can be hosted on youtube.com

A. How to Install Applications in Termux from the APT repository

When you use Termux it is recommended to use the pkg package manager which is a wrapper for the apt package manager.

With pkg you will find it easier to install and upgrade packages automatically without having to manually update apt lists by typing apt update like when using the apt package manager.

PKG HELP MENU: Type pkg help to see the options provided by the Termux pkg package manager

LOOKING FOR PACKAGES: Use the command pkg search <package name> to search packages by name.
For example, pkg search TBomb.

INSTALL PACKAGES: Use the command pkg install <package name> to install packages.

DELETE PACKAGES: Use the command pkg uninstall <package name> to delete packages.

REINSTALL PACKAGES: Use the command pkg reinstall <package name> to reinstall packages.

PACKAGES INFORMATION: Use the command pkg show <package name> to display detailed information about packages.

FEATURING INSTALL PACKAGES: Use the command pkg list-installed to display a list of packages installed in your Termux.

SEE LOCATION OF PACKAGES: Use the command pkg files <package name> to view the location of installed files packages.

SHOW ALL PACKAGES AVAILABLE: Use the command pkg list-all to display all packages provided in the repository.

UPDATE AND UPGRADE INSTALLED PACKAGES: Use the command pkg upgrade to update and upgrade packages installed in your Termux.
Note: replace <package name> with the name of your package.

B. How to Install Applications in Termux in the form of File *. Deb

If you have the installer file in *. Deb format from the download, then you can install it in Termux using dpkg (package manager for Debian-based Linux).

INSTALL *. Deb PACKAGES: Use the command dpkg -i ./package_name.deb to install the application in the format *. Deb.

UNINSTALL * .deb PACKAGES: Use the command dpkg --remove package_name to delete packages that were previously installed using the dpkg command.

VIEWING APPLICATIONS *. Deb: Use the command dpkg -l to view a list of the *. Deb applications that are installed on Termux.

Because dpkg has many useful options, you can see the manual via man dpkg.

packages downloaded from ubuntu repositories or other Linux distributions will not be installed because ABI libc is not compatible, and only * .deb packages intended for TERMUX can be installed.

C. How to Install the Applications for Termux in the Form of a Script

If you get the Termux application in the form of a script then you need to install the programming language library so you can run the script in Termux.

If the script that you get comes from interpreter programming languages ​​such as python (*. Py), Perl (*. Pl), or ruby ​​(*. Rb) then you can directly run the script without compiling it, provided you have installed the programming language. in your Termux.

Install Perl, ruby ​​, and python on your Termux by typing the command pkg install perl ruby python

to run the Termux application in the form of a script just use the command perl script_mu.pl or ruby script_mu.rb or python script_mu.py.

Manage Application Script in Termux

In general, applications are divided into 2 types based on how the application is run, namely applications that must be compiled (from home source code into machine language) before they can be run and applications that can directly be run from source code (interpreters) without being compiled.

Applications written in the interpreter programming language will be more flexible and easy to edit as needed, when you use TERMUX you will definitely find a lot of tools / small applications in the form of source code that can be directly run without having to compile, ordinary people call them with the term script.

To run applications written in interpreter programming languages ​​such as Perl, Python, MATLAB, or Ruby you only need to install the interpreter, while to edit the source code/script you can use any text editor.

Programming Language Package Manager

Some programming languages ​​have their own package manager, the package manager for each programming language is not included by default in Termux, so you need to install it manually if you want to use it while learning Termux.

Click on the link above and follow the guide on how to install the package manager for each programming language you want.

Learn to Use Termux Command

Termux does not have a GUI display and is just a shell where you have to type the Termux command code to use it, without you memorizing the Termux command code you won't be able to use Termux.

The Termux Command is the same as the Linux Command.

The Termux command is identical to the Linux command especially the Debian family Linux such as Ubuntu or Linux Mint, this is because of the Termux functions as a terminal emulator that accesses the Linux shell on your android mobile.

Termux Commands are case sensitive

Linux is different from Windows so you have to remember that Linux case is sensitive which means that Linux will look at and treat a letter differently from the letter size (capital or no capital).

This treatment applies in all Linux environments, from naming folders/directories to Linux commands.

Examples of writing Termux will be different from Termux, TermuX, TERMUX although read the same but Linux considers it different because of the size of the letters, not the sound.

make sure you type all commands in the lower case format or all commands are written in all lowercase.

List of Basic Termux Commands

Here are the basic Termux commands that you must master when learning to use Termux, this command code is very useful because this Termux code is often used to install, manage applications, files, and folders if you are serious about learning to hack you should get used to using the Termux command code below :

  • pkg help 

to see the options provided by the TERMUX pkg package manager.

  • pkg search <package name>

for packages by name.

  • pkg install <package name>

to install packages.

  • pkg uninstall <package name>

 to delete packages.

  • pkg reinstall <package name>

to reinstall packages.

  • pkg show <package name>

to display detailed information about packages.

  • pkg list installed 

to display the list of packages installed in your Termux.

  • pkg files

to view the location of installed files packages.

  • pkg list-all

to display all packages provided in the repository.

  • pkg upgrade 

to update and upgrade packages installed in your Termux.

  • clear

This basic command is used to clean the console window.

  • pwd

pwd (print working directory), used to see the position of the current directory location.

  • ls

used to view/list files and directories. use ls -lha to view detailed information from files and folders.

  • cd

Used to navigate/move to another directory that we want, use it cd .to return to the directory level, use it cd ~ to go to the home directory.

  • cp

Used to copy/copy files and folders.

  • mv

Used To move files and folders or can be used to rename if the file/folder has the same origin and destination.

  • rm

Used to delete files.
rm -rf name folder to delete the folder and its contents.

  • rmdir

Used to delete an empty folder.
rmdir --ignore-fail-on-non-empty folder name to delete a non-empty folder.

  • chmod

Used to change File / folder permissions / privilege.
chmod +x Folder name to change permission to 775 or rwx – x – x.

How to hack using Termux

Termux can be used for a variety of things including as a hacking tool, you can turn your Android phone into a sophisticated hacking tool just by installing the Termux in which the hacking tools installed are commonly used by ethical hackers (professional penetration testers).

I have listed some main tools which are used for hacking and penetration testing. You can install these tools on Termux:

  • Metasploit Framework: Metasploit is a very popular hacking tool, with this tool you can create, test, and run an exploit to exploit vulnerabilities on a system as an entry point to take over the system.
  • Wireshark: Wireshark is an application for analyzing packages in a network. This application is commonly used to analyze networks, troubleshooting networks, developing software and communication protocols as well as tools in teaching and learning. You can install the Wireshark application on your android mobile with Termux for hacking purposes, wherewith this tool you can get a lot of information on a network that you want to hack.
  • Nmap: Nmap is a network scanner application, Nmap is used to find computers and services on a computer network on how to send packets and analyze the responses received. Nmap provides a number of features for probing computer networks, including for finding hosts and services and detecting the operating system used. Come hurry up install Nmap on your Android cellphone if you want to scan the network and see who is on the same network as you or you want to get information from a host computer.
  • Other tools: there are hundreds or even thousands of tools that are made for specific purposes when hacking, so you can find them yourself on the internet hacking tool that suits your needs.

Termux GUI

Termux is a terminal emulator for accessing the Linux shell on your android, if you have a GUI based application then you will not be able to run the application/package in Termux directly and you will see a warning " TERMUX ERROR" Gtk-WARNING **: cannot open display:: 0.0 "

This is because Termux does not find a display that will be used by the application, to overcome this you have to activate the GUI on Termux first.

Backup and restore Termux

After all this time you learn Termux and work with Termux on Android such as installing, trying, setting up various applications on Termux, of course, you don't want all your hard work to be lost instantly caused by a glitch/error on Termux applications or damage to your Android phone.

Why should you Backup Termux

To overcome and prevent this bad thing from happening, Termux has provided an application/package restic that you can install and use to backup or restore the backup results.

It is better if you put/save the backup file in external storage such as SD Card or OTG Flashdisk, because if you back up in internal memory then your cellphone is damaged, how do you get the backup file and try it.

FIX storage permission denied Termux

When learning Termux for the first time you will definitely encounter an error "storage permission denied" because Teermux does not have permission to access storage (internal and external storage).

To overcome this, make sure your Termux has been given permission/permission to access SDCard / storage.

If you have not run the command, Termux-setup-storage select allow/allow if a dialog popup appears.

Or you can go to the settings menu on your android> application / apps> termux> permissions> slide / check on storage

How to backup Termux

To be able to backup Termux easily and safely you should use the restic application, if not you can install it first with the command pkg install restic

  • Create a directory to store backups on the Sdcard with the command mkdir -p /sdcard/termux-backups
  • Make the local directory that you have created a local repository with the command restic init -r /sdcard/termux-backups.

In this process, you will be asked to create a password (after making it until you forget or your backup results cannot be used)

  • Start the backup process by typing the command restic backup -r /sdcard/termux-backups --tag termux $PREFIX.
  • Restic applies a single incremental backup method, so even if you back up many times the result there is only 1 backup file with a change in size according to the number of packages in your Termux.

So it's not us worrying about full storage because of frequent backups. To do the backup again just type the command restic backup -r /sdcard/termux-backups --tag termux $PREFIX.

How to restore Termux

How to restore the following Termux assuming the backup file is located in "/ sdcard / termux-backups" if the backup location is different you can adjust the commands you will run.

Make sure you have installed the Restic application first if you haven't installed it first by running the pkg install unstable-repo last command pkg install restic

The process of restoring Termux is a bit complicated compared to how to backup Termux because we will delete the existing environment and replace it with a backup environment.

  • Copy the restic application to $ HOME, so that the restic can be run directly from the current working directory location (by default in $ HOME) by typing the command cp $PREFIX/bin/restic $HOME/restic and to make sure you are at home run the command cd ~.
  • Unset LD_PRELOAD (disable termux-exec) with the command unset LD_PRELOAD.
  • Delete the old $ PREFIX with the command rm -rf $PREFIX.
  • Restore Termux from the Termux-backups folder with the command $HOME/restic restore -r /sdcard/termux-backups --tag termux --target / latest.

If everything is done properly you should have successfully restored the Termux from the backup file, just close the Termux application then run again and enjoy.


Termux is just an application that is used to access the Linux shell on your Android, Termux is not only used as a hacking tool, more than that it can be used for other purposes according to the user's computer expertise.

it's true that with Termux hacking activities can be more flexible, if in the past hacking people had to bring a laptop that was installed Linux, now you can use the Android cellphone installed with Termux to do hacking activities.

Because basically android is one variant of Linux, by installing the Termux application you can access the Linux android shell like you are using a laptop that has Linux installed.


Previous Post Next Post