Termux

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 12

The Termux Wiki

Termux is a terminal emulator and Linux environment for Android,


Chromebook, and Fire OS.

Introduction

IRC Weechat on Termux

Termux is an Android terminal emulator and Linux environment application


that works directly without rooting or configuration. A minimal basic system is
installed automatically, additional packages are available using the APT
package manager.

User interface
How to use the application.
Software
How you can install more software.
Hardware
How to use an external keyboard and mouse.

Facility
Google Play

F-Droid

Addons
Termux has some additional features. You can add them by
installing plugins:

Termux:API
Access Android and Chrome hardware features.
Termux: Boot
Run script(s) when your device starts.
Termux: Float
Run Termux in a floating window.
Termux: Styling
Have powerline-ready color schemes and fonts customize the
appearance of the Termux terminal.
Termux: Task
An easy way to call Termux executables from Tasker and compatible
applications.
Termux: Widget
Launch small scriptlets from the home screen.

Frequent questions
Termux FAQ

 What is a termux?
 I am a beginner. What can I use termux for?
 Can I do hacking with Termux?
 How can I get help on a specific package?
 Can I contribute?

And more ...

Community
Can't find a solution in the FAQ ?

Do you just want to meet us?

Do you want to help Termux developers and


users contribute to the project?

Take a look at the community pages . Whether


for fun or serious work, join us.

Frequently asked questions

General questions

Can I contribute?
Yes, contributions are welcome. Termux is an open source application and is
based on user contributions.

You can search the source code for all Termux parts on Github . However, the
main components are:

 Termux-app - source code for the Termux app.


 termux-packages - scripts and build environment for the packages.

If you want to request a particular package or submit a bug report, please


open an issue on termux-packages/issues .

App-related suggestions and bug reports should be submitted to


termux-app/issues .
Can I do hacking with Termux?
Main article: Hacking.

If you can.

We have some tools that can help you hack, like hydra (brute force tool) or
nmap (network scanner). We have a ton of compilers (Clang, Rust, Go, etc.) and
interpreters (Bash, Perl, Python, etc.). The radare2 reverse engineering tool is
available. Additionally, Termux can run metasploit-framework, allowing
Termux users to do some serious hacking stuff!

Tools like aircrack-ng or tcpdump can be found in the Termux root package
repository. To enable it, see Package_Management #
Installation_root_packages . But please note that Aircrack-ng requires wifi
monitor mode which is not available for most devices.

Important Note : We are not teaching how to hack/crack someone or


something. We are not hacking/cracking something or someone by request.
Just remember: hacking without permission is illegal!

The Gitter and Google+ communities are moderated. All questions like How to
hack wifi? How to hack Facebook account ? , Can you teach me how to use
the Brute/crack/hack tool? will be deleted.

Warning: There are many "Termux hacking tutorials" on the Internet that
provide suspicious software intended to be used as hacking tools. Most of
them are made for clickbait and do not work in the real world. Some of them
force the user to install malware on their devices. We are not responsible for
broken Termux installations, bricked devices and lost data.

Can Termux be installed on Android <5?


Termux is only available on Android 5.0 or later.

See https://github.com/termux/termux-app/issues/6 for more information.

How can I get help with Termux?


This wiki is a good start to the basics of Termux. Other options include:

 IRC : #Termux channel on freenode that is mirrored with Gitter .


 Github – Submit bug reports related to the main app, packages, and
plugins. Create pull requests for your solutions.
 Gitter – Chat room mirroring with IRC .
 Google+ Community : You can ask general questions here.
 Reddit – alternative to Google+ (ask general questions here).

Consider researching Termux on the Internet, i.e. the Termux site: github.com

I am a beginner. What can I use termux for?


For the same purposes as any of the Linux distributions.

You may want to take a look at the Bash guide to learn how to use shell. Also,
browse the Termux Wiki to learn more about using the Termux app.

If you are searching for a specific package, use the pkg search {pkg_name}
command with changing '{pkg_name}' to the actual package name. Install the
necessary packages with pkg install {pkg_name} . For example, if you are
interested in programming, you can try packages like python , nodejs , ruby ,
clang , and others. Code (text) editors are also available: vim , nano , micro ,
etc...

See related articles:

 Development Environments
 Linux differences
 Package management

Is Termux down?
Is Termux down? I am getting this error:

Unable to install
Termux was unable to install the boot packages.
Check your network connections and try again

This happens when a new installation cannot connect to the website for some
reason to download and install the boot packages. If this message continues
to repeat itself on consecutive attempts, try resetting your network
connections:

1. Turn on airplane mode.

2. Wait a moment.

3. Turn it off again. Make sure Wi-Fi and/or mobile network are enabled.

4. Then tap the Termux icon again.


There are few users who do not have Internet access to Termux repositories.
There are 2 main reasons why this happens:

 Bad ISP. There may be various problems, such as spoofing the domain or
blocking the IP address/subnet of the resource (censorship).

 CloudFlare blacklisted your IP address due to an outbound attack.

The 2 cases listed above can be solved by VPN. Please note that IP addresses
of free VPNs may be blacklisted.

What is a termux?
Termux is a terminal emulator for Android. The key difference from other
terminal emulators is its own package repository with a large set of various
utilities.

The terminal emulator is a program that provides a text-based interface to the


shell. For more information, see a Wikipedia page .

Application

How do I use my storage in Termux?


To grant storage permissions on Android, go to Settings > Apps > Termux >
Permissions and select storage, then run termux-setup-storage in Termux.

Learn more at Internal and External Storage .

I have little available space, can I install Termux on the


external SD card?
No.

External SD cards are usually formatted in FAT32 or exFAT file systems which
do not have support for Unix permissions (chmod/chown) and special files
such as sockets or symbolic links. Also, Android enforces the noexec mount
option for user storage, so you won't be able to run binaries.
Are there buttons like 'ctrl' or 'esc' available in Termux?
Main article: Touch keyboard

Yes. You may want to refer to the Touch Keyboard page for information on
available key combinations and how to enable the row of additional keys .

Output when trying to install any plugin, "Cannot be


installed due to an unknown error."
All Termux plugins must be signed with the same key, which means you must
install Termux from Google Play and also termux style from Google Play, and
not the other way around between F-Droid and Google Play, since the main
app and plugins use the same key to sign.

Where is the help in the application?


Press and hold to bring up the context menu anywhere on the device: tap
MORE and select Help from the menu.

See http://tldp.org/LDP/intro-linux/html/sect_02_02.html for Absolute Basics


Linux Quickstart.

Why does Termux have read-only access to external SD


card?
In recent versions of Android, write access to the external SD card is done
through the Storage Access Framework. It is not possible to provide your API
to command line programs.

There are several solutions:

 Use root to put necessary files to external SD.


 Use custom ROMs. Some of them have disabled SD card access restriction,
so you can freely access your external SD card.
 Use a private Termux directory on the external SD card. Typically your
path should be /storage/XXXX-XXXX/Android/data/com.termux .

packages
Can I install all Termux packages?
Probably not, some packages are known to conflict with each other, for
example Dropbear and OpenSSH. But you can still install most of the
packages, this will take about 3.5 GB of space on the internal storage.

1. Use apt install * on an empty directory. This will produce an error and this
is exactly the result you want for step one. Study the output to discover
conflicting packages, then find a way to select only packages that do not
cause conflicts.

2. Install using the globbing file . For example, apt install [ah]* will install all
packages that begin with the letters ah. But this will probably also cause
conflicts.

How can I get help on a specific package?


Usually packagename -h will show basic help on usage.

Also install the man tool to view man pages for various tools. Use pkg install
man to install man . Writing man man or man info information can help both
beginners and advanced users. For example, man busybox will display the man
page for the 'busybox' package.

Tips, when reading the man page:

 Use q to abandon the man.


 Use space for next page
 / search search
 n to repeat the search

I need to download the package. How can I do that ?


Termux does not provide older versions of packages. This is called "rolling
release."

You can try to build a package with a specific version yourself. The scripts
and build environment are located on Github in the termux-packages
repository .
I updated the termux packages as root and now I get
'permission denied' as a non-root user.
The main problem is trying to manipulate files that were modified as the
superuser. This is likely an SELinux context issue, which can be confirmed by
checking that the output of /system/bin/getenforce is 'Enforcing'.

For individual files, we can fix the file context at the root ( restorecon <file-
name> ) and revert ownership of the affected file ( chown <user>:<group> <file-
name> ). Note that <user> and <group> are running id as a non-root user. In
case many files are affected (e.g. due to package upgrade), change the
directory to /data/data/com.termux/ and run restorecon -R . and chown -R
<user>:<group> . Recursively apply changes.

Termux has only a few packages. Can I use a Debian


repository instead of a Termux one?
No, You can not.

There is an important difference between Termux and regular Linux


distributions and packages from these repositories will not work. See Linux
Differences for more information.

If you need a package, you can request it in termux-packages/issues .

termux environment

Can I run other Linux distributions on Termux?


Yes, see PRoot . PRoot benefits include running Linux operating systems on
Termux on a smartphone and tablet on Android , Chromebook , and Fire OS .

I want to use Termux packages in my own project, can I


do that?
If you can. But make sure that your project will not violate any of the licenses.
It is highly recommended to recompile these packages due to the hardcoded
environment paths. Create environments and scripts that you can find in the
termux packages on Github.

Take a look at the environment variables defined in build-package.sh :

 TERMUX_PREFIX - a path to the root of the environment.


 TERMUX_ANDROID_HOME - a path to the home directory.
 TERMUX_PKG_API_LEVEL – A minimum Android API level.

And change them according to your needs.

How do I fix a broken environment?


Main article: Recover a broken environment.

If the only output you see is [Process completed - press Enter] or a variation
thereof, your Termux environment is broken. You can try to fix this by using a
failsafe session.

If you removed or modified a binary in $PREFIX , the best way would be to


reinstall Termux or perform the procedure described in Recover a broken
environment: If the problem is not in the dot files .

How to ssh into termux?


Main article: #SSH Remote Access

If you have installed the OpenSSH daemon, you can start it with the sshd
command. Also, the "standard" SSH port on Termux is 8022. So, to connect to
Termux via SSH, you need to use the command ssh -p 8022 {ip_address} ,
substituting {ip_address} with the real IP of the remote device.

Please note that Termux supports password and public key authentication. All
information can be found on the #SSH remote access page.

Is Termux a complete Linux environment?


Main article: Linux differences

Yes it is! But there are some differences with traditional Linux distributions.
Firstly, Termux is not an operating system, it is a terminal application, a text-
based interface to the shell. Secondly, Termux is a pre-built environment. Its
directory structure is slightly different than that defined by the FHS standard.
That is, in the Linux distribution we have /bin , but in Termux it is $PREFIX/bin
where $PREFIX refers to /data/data/com.termux/files/usr . This makes a big
difference in installing and building packages.

See this topic " etc is in the wrong place " and Main article: Differences from
Linux for more directory structure and environment information of $PREFIX

Why do I keep getting the '/bin/sh bad interpreter' error?


The error you are getting when running third party scripts would be something
like:

{program_name}: ./Configure: /bin/{program}: bad interpreter: permission denied

The terminal throws an error because we don't have access to main /bin of
the Android root directory (for non-rooted), instead we use prefixed bin i.e.
$PREFIX/bin .

First line of the script:

#! /bin/{program}

There are three ways to fix this:

 Install termux-exec using pkg install termux-exec . After installation, it will


not affect the current session, but each future session should work without
any configuration.

 Use termux-fix-shebang from termux-tools to change the shebang line.

Which will change /bin/{program} to $PREFIX/bin/{program} .

 Use proot 's termux-chroot to set up a chroot that mimics a normal Linux
filesystem in Termux.

Why do I keep getting 'Exec format error' for copying


binary from my computer?
You are trying to run binary for different CPU architectures. That is, it is not
possible to run x86 binaries on ARM or AArch64.
Recompile your binary for the correct architecture with Android NDK and it
should work fine. It is possible to check your current arc with the uname -m
command.

Why do I keep getting 'No such file or directory' when


trying to run a binary file (file exists)?
This happens when you are running binary build for Linux distribution, for
example Ubuntu or Arch Linux. This is due to the ABI difference between GNU
libc and Bionic libc.

Create a suitable chroot (proot) environment and try to run binaries from it.

Why do I keep getting 'permission denied' when I try to


launch a script?
If you are having a problem running bash scripts, please read the following:

Both internal shared storage ( /sdcard , /storage/emulated/0 ) and external SD


cards do not support executive permissions. You must move your scripts to
Termux's $HOME directory and set permissions ( chmod +x <scriptname> ) before
you can run it. Alternatively, you can call your script with an interpreter:
python script.py , bash script.sh

Edit

CONTENT to top

 The Term
 Introducti
 facility
 Accessori
 frequent q
 communit

You might also like