Termux Tutorial | Complete Termux Commands

Hi there, Now You can use Almost all Useful Hacking Tools, Scripts on Your Android Mobile

There are many apps and hacking tools availa1ble for Android phones, so we can install Kali Linux on them, but it will take some time and effort.

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.

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.

What is Termux?

Termux is a Powerful Android app that is Designed to Install Linux packages on your Android Mobile.

Termux is a terminal emulator for Android as well as a Linux environment that works on Android without the need for rooting or specific configurations. The APT package manager can be used to install additional applications/packages.

You can install shell, python, c, c++, Perl, ruby, java, and many more helpful packages with this Termux App, and we can utilize various hacking tools/scripts on our mobile with Termux, such as Nmap, Hydra, and Sqlmap.

If you want to use only the tools you need, read this article completely to learn how to use the Termux app and how to use simple termux commands to install hacking tools on your Android phone.

What sets Termux apart from other terminal emulators is that it has been set up in such a way that the Termux environment is identical to the Debian standard Linux environment.

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

With features and environment changes like the ones listed above, Termux stands out because it allows you to install Penetration Testing Tools (pen-testing tools) / hacking software like Metasploit and NetHunter on your Android phone.
Termux also comes with a package manager (APT) that makes it easier to find and install the packages you require from the Termux software repository.

(APT) that makes it easier to find and install the packages you require from the Termux software repository.

Recommended Guides

How does it work

The terminal emulator is software that uses a system called execve to execute a command-line program and redirects standard input, output, and error streams to the display.

Most terminal programs for Android OS function with a small collection of utilities that are usually offered by the operating system or other rooting tools like Magisk. We’ve decided to take things a step further and port common software found on GNU/Linux PCs to Android OS.

Termux is not a virtual machine, nor is it an emulated or simulated environment of any kind. All of the offered packages have been cross-compiled using the Android NDK and just require compatibility updates to run on Android. Because Termux does not have full access to the operating system’s file systems, it cannot install package files in standard folders like /bin, /etc, /usr, or /var. Instead, all files are placed in the private application directory, which can be found at

/data/data/com.termux/files/usr

That directory is known as “prefix” and is commonly referred to as “$PREFIX,” which is also a Termux shell exported environment variable. This directory cannot be modified or transferred to an SD Card for the following reasons:

  • The file system must have support for Unix permissions and special files such as symlinks or sockets.
  • The prefix path is hardcoded into all binaries.

In addition to prefix, users can store files in the home directory (or “$HOME”) available at

/data/data/com.termux/files/home

However, the file system is not the only difference from the traditional Linux distributions. 

WHAT ARE THE USES OF TERMUX?

It depends on you!!

Yes!! You can use it as needed. It can be used for,

  • Programming in a development environment
  • Hacking
  • Web development
  • Learning the basics of Linux CLI (command line interface)
  • Manage and edit files with nano, vim, and emacs
  • Develop C with clang
  • Check out and install git projects, and text-based games

Okay, Guys Without wasting your valuable time am going to present you the Termux Commands list in a simple & short way, I was planned to create a Termux commands list pdf, due to lack of time, am posting the commands directly on this post.

What are Termux Commands?

in simple words, Termux Commands are the terminal commands, which is executed to perform a particular task. These commands are similar to Linux Commands.

That’s all you will be able to use sqlmap on your Mobile

We have presented some information gathering and Vulnerability scanning Tools and Told you How To Install Them in Termux

You can Install and Use The Hacking Tools written in PHP, Python, or any other programming language.

List of Termux commands for Package management

List of Termux CommandsUses of Termux Commands
pkg search PACKAGE NAME HEREAllows you to search a particular package.
pkg install PACKAGE NAME HEREInstall a package.
pkg uninstall PACKAGE NAME HEREuninstall a package.
pkg reinstall PACKAGE NAME HEREReinstall a package.
pkg show PACKAGE NAME HEREGet detailed inormation about the package.
pkg-list-installedList installed Termux package.
pkg-list-allList all available package for Termux.
pkg autocleanRemoves packages which are not longer needed.
pkg cleancleanup the local cache of packages downloaded from remote repositories.
pkg files PACKAGE NAME HEREShows the location of the files.
pkg updateUpdate the Termux packages.
pkg upgradeUpgrade the Termux packages.
pkg update && pkg upgrade -yUpdate and Upgrade the Termux packages.

List of Termux basic shell commands

List of Termux CommandsUses of Termux Commands
historyShows the history of previously typed commands.
calShows Calander.
dateShows current date.
helpDisplays information about shell built-in commands.
exitUse this command to close the Termux.
uptimeShows the uptime of your operating system.
dfDisplays the amount of disk space available on the file system.
findSearch for files in a directory hierarchy.
suChange user ID or become superuser.
echoWrite arguments to the standard output.
passwdChange user’s password. If no user is specified, changes the password for the current user.
duSummarize disk space used for each FILE and/or directory.
whoamiDisplays user, group and privileges information for the user who is currently logged on to the local system.
ifconfigConfigure network interface parameters.
pingSend ICMP ECHO_REQUEST to network hosts.
netstatPrint network connections, routing tables, interface statistics, masquerade connections, and multicast memberships.
sleepSuspends program execution for a specified time.

List of Termux commands for File Management

List of Termux CommandsUses of Termux Commands
lsList information about files and directories within the file system.
touch FILENAMECreate a new file.
cat FILENAMEcat command is used to display the contents of a file.
cpcp command is used to create the copy of a file.
mvmv command is used to move a file from source to destination.
rm FILENAMEdelete a file
rm -rf DIRECTORY NAMEForce delete the given directory.
mkdir NEW DIRECTORY NAMECreate a new directory.
rmdir DIRECTORY NAMERemove a directory.
cd DIRECTORY NAMEChange the directory.
pwdPrints the current working directory.
chmod 777 FILENAMEModify the permission of the file. Anyone can read, write, and execute the file.

Some additional Termux commands list

List of Termux CommandsUses of Termux Commands
zip FILENAMECompress a file.
unzip FILENAMEDecompress a file.
wget URL HEREDownload a file from the web.
git clone URL OF GITHUB HEREClone the packages from Github to your system.
envAllows you to display your current environment or run a specified command in a changed environment.
termux-setup-storageGrant Termux to access the device storage.

Termux Function

The main purpose of Termux is to allow you to access the Linux shell on your Android phone; however, it also emulates the Debian Linux environment, giving you the impression that you are using a Debian Linux shell.
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 unique is that it creates methods for installing and running ordinary Linux apps on Android, as well as hosting its own software repository.

Development and experiment Environments

Termux is commonly used by application developers during the development process and to test their applications. Because Termux gives developers access to the Android shell, it will be easier for them to troubleshoot and locate the source of faults in the apps they try.
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 tools

Previously, if you wanted to hack, you needed a laptop with a Linux operating system installed. Now, thanks to Termux, you can use your phone as a hacking weapon because Android is one of the Linux variations.

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.

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 problems in installing and configuring Termux. Then you can watch this video about how to install and configure Termux.

Accessing and managing files in termux

To manage and access files in termux then you must type the below command

termux-setup-storage

To access a directory cd command is used
The termux default directory is located at /data/data/com.termux/
You can access it anytime by typing cd $home


ls command is used to see the list of subdirectories


To access your internal sdcard you have to type cd /sdcard && ls


To Access your External Sdcard the same command is used cd /sdcard0/ && ls


To Remove/delete an empty Directory or a file, use this command: rm -rf filename
Where filename belongs to the name of the file or directory
Similarly, you can use rm-r filename


To Make a Directory mkdir Command is used
Eg: mkdir Hello
Where Hello Belongs to a Directory Name


For Copying files from one directory to another, cp Command is used
eg: cp /path/file /path
Similarly for moving files mv Command is used

Termux also Supports zipping and Unzipping of Zip files
For that zip , unzip Commands are used


How to install applications in Termux

Termux has been updated to allow you to install a variety of Linux programs on your Android phone; applications that can be installed using Termux are listed in the Termux software repository online.The APT package manager allows you to simply search for, download, and install the packages (the word for programs in Linux) that you require.

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.

All repositories with build scripts on the github.com/termux repo are managed and verified by signature by an officer on the Termux team.
There is also a community repository, which is a repository created by individuals, in addition to the official repository controlled by the TERMUX team.

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’ve finished developing the app, you can package it as a repository and host it on Github using termux-apt-repo from the command line.

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

How to hack using Termux

Termux can be used for a variety of uses, including hacking. By installing Termux, you can convert your Android phone into a sophisticated hacking tool, including hacking tools that are often 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 FrameworkMetasploit 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.
  • WiresharkWireshark is a tool for studying packets in a network. This application is often used for network analysis, network troubleshooting, software development, and communication protocol development, as well as teaching and learning tools. You may use Termux to install the Wireshark program on your Android phone for hacking purposes, and this tool will provide you a lot of information about the network you want to infiltrate.
  • Nmap: Nmap is a network scanner tool that is used to locate computers and services on a computer network, as well as to send and analyze packets. Nmap has a number of features for probing computer networks, including the ability to locate hosts and services as well as determine the operating system being used. If you want to scan the network and discover who is on the same network as you or get information from a host computer, hurry up and install Nmap on your Android phone.
  • 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.

How To Use Hacking Tools  in Termux

Firstly Download and Install Termux App On your Mobile from Play store

It doesn’t Matter your mobile is Rooted or Non Rooted

After Downloading Open Termux

Now Type

apt update && apt upgrade

And hit Enter

Now Type

termux-setup-storage

Now You are Ready To install useful packages and hacking Tools on your Mobile, we are sharing some of the tools with their installation and simple commands in termux.

How to Install Onex in Termux

onex a hacking tools library.” Onex is a kali Linux hacking tools installer for termux and other Linux distributions. It’s a package manager for hackers. onex manages a large number of hacking tools that can be installed with a single click. Using onex, you can install all hacking tools in Termux and other Linux-based distributions. onex can install more than 370+ kali Linux hacking tools. use onex install [tool_name] command to install any hacking tool.

apt update

apt install git

git clone https://github.com/rajkumardusad/onex.git

chmod +x onex/install

sh onex/install if not work than use ./onex/install

How to use:-

  • onex install [tool_name] install any tool.
  • onex -i [tool_name] install any tool.
  • onex search [tool_name] search any tool.
  • onex -s [tool_name] search any tool.
  • onex list list all tools.
  • onex help get help.
  • onex -h get help.

Backup and restore Termux

After all this time learning Termux and working with Termux on Android, such as installing, testing, and setting up numerous Termux applications, you don’t want all your hard work to be lost due to a Termux application bug 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 recommended to store the backup file to an external device such as an SD Card or an OTG Flashdisk, because if you save it to your cellphone’s internal memory, your phone will be damaged, and there will be no way to retrieve the backup file and test it.

FIX storage permission denied Termux

Because Teermux does not have permission to access storage, you will almost certainly get the error “storage permission denied” when learning Termux for the first time (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.

As a result, we don’t have to be worried about going out of storage space due to frequent backups. Simply execute restic backup -r /sdcard/termux-backups —tag termux $PREFIX to restart the backup.

How to restore Termux

What is the best way to restore the following? Termux assumes the backup file is at “/ sdcard / termux-backups”; if the backup file is in a different directory, you can change the instructions you’ll run.

If you haven’t already, make sure you’ve installed the Restic application by using the pkg install unstable-repo last command pkg install restic.

Because we will delete the original environment and replace it with a backup environment, the process of restoring Termux is a little more involved than backing it up.

  • Copy the restic application to $ HOME so that it may be run directly from the current working directory (which is $ HOME by default) by entering the command cp $PREFIX/bin/restic $HOME/restic and then cd to make sure you’re at home.
  • 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 went well, you should have been able to successfully restore Termux from the backup file. Simply close the Termux application, restart it, and enjoy.

How can I contribute?

The best ways to contribute are:

  • Improving the Termux Wiki pages, i.e. by fleshing out sections that could use additional information or by correcting errors in grammar.
  • Submitting bug reports. Please only submit reports that are about Termux packages or applications. Other errors should be submitted elsewhere.
  • Submitting package updates.
  • Submitting pull requests with bug fixes and improvements.

All of the source code for Termux can be found at https://github.com/termux.

Frequently Asked Question

(Originally Published: Termux )

  • What is Termux

Termux is a terminal emulator for Android OS with its own package ecosystem. There are more than 1000 packages for various purposes, including code editors, compilers, etc.

  • Is Termux an emulator

Termux is both an emulator and a virtual machine. It does not emulate any system; instead, programs are run directly. It is, however, a terminal emulator in the same way that many popular Linux distribution apps are, such as GNOME Terminal, Konsole, Xterm, and others.

A terminal is a hardware device typically used before traditional desktop computers appeared.

A terminal emulator is a software that emulates a display (not CPU or the whole system) with the capabilities of a specific hardware terminal.

  • What are system requirements?

As a minimum, Android OS version 7.0 is required. You should expect Termux to consume a significant amount of internal storage because you’ll be dealing with software ported from Linux distributions. That’s usually 500 MB to 5 GB, but it can be greater in some circumstances… Everything is contingent on your usage scenarios.

Also, it is preferable to have AOSP Android, to avoid vendor-specific quirks with process management and power-saving.

  • Will Termux work on Android 11

In short: yes, it works on Android 11 and even 12 betas.

The latest SELinux setting limitation on the ‘execve()’ system function introduced with Android 10 was not an exception to this rule. People claiming to be “advanced users” have spread a lot of disinformation and conspiracy theories about what is truly going on (e.g., “Google wants to eliminate Linux on Android”).

Data files will no longer be executable in applications produced with target SDK level 29 (which means compatibility with Android 10) or higher. Within the APK file, all executables must be bundled. That is a reasonable restriction. The application must not be capable of self-modification. Updates and new features must be included in a newer version’s APK. There is, however, a problem: Termux is a technical bridge that connects Android apps to Linux environments.

Fortunately, we chose to force use compatibility with Android 9 APIs (SDK 28) at the cost of the ability to publish updates on Google Play. That is until we will work around the issue. For now, do not worry – it works perfectly.

  • Why does htop or netstat not work on my device?

In order to stop leaking sensitive information via side channels, Android has blocked access to certain interfaces in /proc. This is done for your privacy.

Specifically:

  • /proc/net/*
  • /proc/loadavg
  • /proc/stat
  • /proc/uptime
  • /proc/version
  • /proc/vmstat
  • And a few others.

The restrictions vary depending on the Android OS version. As a result, Android 7 is less constrained than Android 8/9/10+. You can get around them by using root.

Do not open issues in our repositories on this or complain about how Google is evil. We do not support such an opinion or another Android-specific conspiracy.

  • Why does ps not show Android processes?

Since Android 7, regular applications no longer can explore foreign processes in /proc. This has been implemented via the hidepid=2 mount option.

Termux can list only its own processes. You can see more only under rooted shell or ADB.

This restriction has a weird effect on some programs. For example, some processes like ssh-agent or tor daemons will no longer be visible through ps and as result can’t be terminated with pkill  or killall  but only with kill .

  • Why is my Termux is 32bit while CPU supports 64bit

If Android OS claims that only 32-bit ABIs are supported, Termux will only do a 32-bit installation. Its environment is not self-contained and relies on operating system libraries. You’re out of luck if your machine is only 32-bit. This is a regular problem with some device models when the manufacturer only installs a 32-bit operating system due to a tiny system partition.

  • Can Termux be installed on the external storage?

This can’t be done, at least if your device is not rooted.

Termux requires a native Linux file system such as EXT4 or F2FS for supporting special files like symbolic linkssockets, and Unix file attributes. Neither FAT32 nor exFAT supports them. Furthermore, Android applies a special overlay to any general-purpose file storage which turns the underlying file system into FAT32 or exFAT-like in order to solve certain issues and provide a better experience for the average user.

If your device is rooted and you want to install Termux on external storage, please refer to the post on Android Enthusiasts Stack Exchange.

  • Any tips for using Termux

Here are the ones which should help you to survive in the Termux shell:

  • Learn shell scripting!
  • Always do pkg upgrade!
  • Do backups, always!
  • Do not execute things that you do not know!
  • Carefully read everything that has been printed to the terminal!
  • What do you use Termux for

You can do everything, specifically what you are able to do with it. That is the case where you are limited mostly by your skills. Of course, OS and device hardware restrictions matter too, but they are insignificant.

Here are just a few ideas for Termux usage:

  • Device automation with scripting and Termux Tasker add-on.
  • File transfer & synchronization via syncing, rsync, rclone, etc.
  • SSH client (dropbear, openssh).
  • Programming (clang, python, vim, etc).
  • Are there any Termux tutorials

Note that while you can learn shell scripting with Termux, it is not the best tool for this due to a few fundamental differences from the Linux distributions.

  • What are the advantages of root in Termux?

Root gains you control over system components. You will be able to access freely all file systems, modify device firmware (ROM) as well as perform fine-tuning of kernel configuration, networking, etc.

Certain tools like cryptsetup, mount, Nmap (advanced scan modes), tcpdump require root access.

  • What is a fake root

Fake root means exactly “fake root”, i.e., not real root. It does not provide any real superuser privileges. It just changes the user ID and labels to assist in certain tasks.

There 2 ways to get a fake root:

  • Package `fakeroot` – useful solely for packagers who need to create archives with files having certain ownership and permissions. Of course, using the real root, in this case, is overkill.
  • Package `proot` – run a rootless Linux distribution “chroot”.

The fake root will not help you to root your device. Neither will help you to run software requiring superuser privileges.

  • Can I hack social media with Termux?

As some people say, there is nothing impossible in the world, and that’s true in the case of Termux and specifically this question. However, we do not provide any help on it – you are on your own.

Hacking and phishing topics are discouraged within all official Termux communities.

  • Where are Metasploit and Hydra packages

Packages Hashcat, Hydra, Metasploit, and Sqlmap have been removed from Termux repositories. We do not accept requests for hacking packages and neither provide help for using or installing them.

  • How can I hide the extra keys

Tap key combination Volume Up + K.

An alternate approach is to open the drawer via swiping rightwards from the left screen side and then long tap on the “Keyboard” button.

  • Why app from F-Droid cannot be installed

Open your Android settings –> Applications and check whether you have applications containing the word “Termux” in their name. If so, uninstall all of them: Termux, Termux:API, Termux:Styling, Termux:Widget, Termux:Boot and others. And yes, paid add-dons should be uninstalled too.

After that, you should be able to install the Termux app from F-Droid.

  • Why Termux add-ons on Google Play are paid even though their sources are on GitHub

This has been made as a kind of donation. If you do not want to donate, use application and add-ons from F-Droid or custom builds from sources.

Remember that open-source or free software does not mean that software cannot be paid for. This is not forbidden by licenses of our source code. Also “free” means “freedom”, in the context of GNU GPL which even explicitly states that free software can be paid for as soon as sources are freely available.

 

Conclusion

Termux is a simple application that allows you to access the Linux shell on your Android device. It’s not just a hacking tool; it can also be used for other purposes depending on the user’s computer knowledge.
It’s true that hacking operations can be more flexible with Termux; previously, hacking required bringing a laptop with Linux installed; now, you can hack using an Android smartphone with Termux installed.
Because Android is essentially a Linux variation, you can use the Termux program to access the Linux android shell as if you were using a laptop with Linux installed.

⚠ Provided Information is only for educational purposes

If you liked this article, then please join to our telegram channel for More Updates. You can also find us on Twitter and Facebook.

Thanks for reading, have a nice day ????

Recommended Readings:

Similar Posts

3 Comments

Leave a Reply

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