Saurav Gautam
Web and Mobile Developer
Hacking with Android | Termux
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.
Termux is neither a virtual machine nor any other kind
of emulated or simulated environment. All provided
packages are cross-compiled with Android NDK and only
have compatibility patches to get them working on
Android. The operating system does not provide full
access to its file systems, so Termux cannot install
package files into standard directories such as
/bin
, /etc
,
/usr
or /var
. Instead, all
files are installed into the private application
directory located at
/data/data/com.termux/files/usr
We call that directory “prefix” and usually refer to
it as “$PREFIX
”, which is also an
exported environment variable in the Termux shell.
Note that this directory cannot be changed or moved to
an SD-Card because:
- 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