DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Cover image for Hacking with Android | Termux
Virtual Wiz
Virtual Wiz

Posted on

Hacking with Android | Termux

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
Enough about Termux…now lets go over how to install it…


Getting Termux

Its fairly simple to install termux…just head over to google playstore and download it…

but since the playstore version no longer recieves updates….its better to get the app from github or f-droid …

Github

F-Droid

after you download the apk all you have to do is install it…VIOLA! you got termux…


What to do first?

The termux application is an emulator only so we need to change what we need.

After installation, run the app…you should provide storage permission (NOTE: its not essential)

Termux does not access your storage but if you need to move or copy any files from your sd card to termux you should type the below command.

termux-setup-storage


Termux Commands

Simlar to Linux,

To access any specific directory use the cd command. For example, cd <directory-name>

ls command will help you to see the subdirectory on your termux.

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

To access your external sd card you have to type cd /sdcard0/ && ls

If you need to delete any directory or files you have to use this command rm -rf <filename>

To create any directory on your termux type mkdir <directory-name>

If you need to copy any files from one place to another place you have to type cp -r <filename> <path>

If you need to move means the same command but a little bit of change mv -r <filename> <path>

Find your IP address or any other network details means you just type the following command on your terminal.

ifconfig

To install any package pkg install <package-name>


Now that you have your hacking environment setup…explore it more and use it for good…

HAPPY HACKING.

Top comments (0)

Now it's your turn.

Β 
Join DEV and share your story.