Mar 12, 2022

Termux command list

Termux is a terminal emulator application for mobile devices. In this document, we are going to talk about Termux and its features. We can use it to install Linux tools on a mobile phone. Here you can find a complete Termux command list and some cool tricks you can do with your devices.

You can download and install it directly from the play store. You can see the following screen after you launch it.

Termux main screen

 

So let’s see some commands we can use with the terminal emulator. If you’re familiar with Linux bash scripting this will be much easier. You can use the same commands here also. however, I’ll explain all things assuming you’re totally new to Linux/Unix environment. So without wasting any more time let's jump into the content.

Directory and File Management

Directories and files are the base of the system. Many times we need to do various tasks related to those. For example, we need. to know what are the files in the current directory, Also we may need to create a new file and add some content to it. We may need to find a file or directory. To do such tasks we need to know how we can manipulate those directories and files with the help of CLI.

 

The working directory

We can always get the current working directory by entering the command “pwd”. pwd stands for “Print Working Directory”. This is a very useful command and is used frequently.

 

$ pwd
/data/data/com.turmux/files/home

 

However, there is a cool trick that can be used to print the current working directory automatically. I’ll explain that later in this tutorial.

 

Walkthrough the directory tree

The command “cd” can be used to change the current working directory. At the moment we are in the /data/data/com.turmux/files/home directory. Let’s change it to data/data/com.turmux/files and use pwd again.

 

$cd  /data/data/com.turmux/files
$pwd
 /data/data/com.turmux/files

 

We don’t need to enter the full directory name if you want to navigate into a subdirectory within the current working directory. Let’s say we are currently in the directory /data/data/com.turmux/files. If there is a subdirectory as notes inside the current directory we can simply jump into that directory by entering the command cd notes. Lets’s see it in the terminal.

 

$pwd
 /data/data/com.turmux/files
$cd  notes
$pwd
 /data/data/com.turmux/files/notes

 

Now we're going to see another method to change the directory. Let’s say we are now in /data/data/com.turmux/files/home/tools and we want to go one step backward. That means the data/data/com.turmux/files/home directory. One way to do this is the classic method by using the cd command with the absolute path n /data/data/com.turmux/files/home/tools. Also, there is a shortcut method for this. We can simply use the cd ../ command for this. That will do the same job.

$pwd
 /data/data/com.turmux/files/home/tools
$cd  ../
$pwd
 /data/data/com.turmux/files/home/

 

Also if we want to go two steps backward we can use the cd ../../ command.

 

/data/data/com.turmux/files/home/tools
$cd  ../../
$pwd
 /data/data/com.turmux/files/

 

Just like that, we can go until the root directory.

Now we are going to combine some cd methods we learned till now. Lets say we are currently in the directory /data/data/com.turmux/files/home/tools. We know there is a directory named config in the directory /data/data/com.turmux. How we can get into that directory. As we saw previously we can go there by entering the absolute path. But typing the whole long path is not a good idea in all cases. So we can use relative paths with the cd command as follows.

 

$pwd
 /data/data/com.turmux/files/home/tools
$cd  ../../../config
$pwd
 /data/data/com.turmux/config

 

Directory listing

We can get a list of all directories and files by using the ls command. If we only use we hidden files will not be listed. (In Linux all files and directories whose names is starting with a single dot are hidden. We can use CTRL + H in Linux or CMD + . in Mac to un-hide them.) . If we use ls -a we can list all files and directories including hidden ones.

 

$ls
data_folder new.txt

$ls -a
.   ..   .data  data_folder  new_folder   new.txt

 

you can see that some directories and files were not listed in the first ls command. But when we use it with the -a flag we got all items.

Creating directories

To create a new directory you can use the mkdir command. Let’s combine s command and mkdir commands as follows.

 

$ls
data_folder new.txt
$mkdir new_folder
$ls
data_folder new_folder new.txt

$mkdir .data
$ls
data_folder  new_folder   new.txt
$ls -a
.   ..   .data  data_folder  new_folder   new.txt

 

At first when we used ls one file and one directory was listed. Next, I created a new directory named “new_folder”. After I use “ls” again you can see our newly created folder is listed there.

Creating files

We can create a file with the help of the touch command. The syntax is touch [filename].

 

$ls 
new.txt

$touch test.c

$ls 
new.txt  test.c

 

Removing files & directories

We can delete a folder or a file with the rm command.

 

$ls
data_folder1 data_folder2 new.txt

$rm new.txt

$ls
data_folder1 data_folder2

$rm  -r data_folder1

$ls
data_folder2

 

To delete a directory we used rm -r. If you don’t put  -r you will be prompted for confirmation.

Package managing

In Linux environments, we don't need to worry much about finding and installing software. They are hundred of applications as packages. We can use commands to install those in our system. In Debian-based systems, we use the apt package manager. Termux developers also offer a large number of packages to install on your device.  

You can list all available packages by entering the command apt  -list.

Termux command list

If you want to install a package you may use the command apt-get install [package_name] or pkg install [package_name].

Make a programming environment

We can install some programming languages like Python, C, Ruby, etc on Termux. 

  • Python

Python is the most used scripting language in hacking and penetration testing. We use it to automate stuff and build tools. Also, Python is highly used in mashing learning.

 

apt-get install python
  • C

C language is the core language of many other programming languages. You can learn computer architecture deeply if you get a good knowledge of C.

 

apt-get install clang

 

  • Ruby

If you want to install Metasploit on termux you need Ruby. Because MSF is coded in Ruby.

 

apt-get install ruby

 

  • Assembly

If you are planning to learn  hacking, Assembly is a must to learn. I suggest you write codes in C, Then disassemble them and learn Assembly.

 

apt-get install binutils

Turn your phone into a web server

You may know that by using Python you can build a simple HTTP server. If you don't know about that read our python simple HTTP server tutorial.

You may use the following command to server on port 4444.

 

python -m SimpleHTTPServer 4444

 

Actually, we install the apache server on your termux environment. Not only apache, PHP, and python also can be installed. So you can run a fully functional web server on your phone.

Some useful tools to install

  • Linux man pages

These are the Linux manual pages for programmers. There are hundreds of documents explaining various API s and tools. For example, if we want to know about the read() function in C you can just type "man read". It will open a page explaining how to work with read function.

You may install the manual pages with the following command.

 

apt-get install man

 

  • Nano editor

This is a simple text editor that can be used in the terminal. We use this tool often in Linux programming and text editing stuff. In the following image, you can see a screenshot of the nano editor.

 

 

Let's say we want to edit a file called exploit.py. What you want to do is just type nano exploit.py and hit enter. If there is a file called exploit.py nano editor will open it in read-mode. If there is no such file it'll create a new file and open it. 

After you complete editing you may press ctr+o to write out to the file.

  • GDB

GDB is a debugger that is used in the Linux platform. IT is an awesome tool when we come to exploit development and reverse engineering. You may learn more about GDB from our debugging binaries with the GDB tutorial.

 

apt-get install gdb

 

  • Open SSH

This is one of the most useful things you can do in the Termux environment. SSH stands for Secure Shell. By using SSH you can access a Linux server from your mobile.

To install SSH client install OpenSSH by entering the following command on your terminal.

 

apt-get install openssh

Networking related stuff

  •  Netcat

You may have heard something called "Hacker's swiss army knife". Yes, that is netcat. We can do much useful stuff with this tiny tool. I have good news for you. Netcat is already installed on termux by default. You can access it with the command nc.

  • Nmap

If you are interested in cybersecurity, I bet you are already familiar with this awesome tool. Nmap stands for network mapper. It is used to scan networks.

So guys this is all for today's tutorial. I know you also know some interesting stuff about the termux. Feel free to share them in the following comment section. Thank you for reading.

Mar 12
Remote Command Execution

In this. article we are going to see another interesting topic in web application hacking. This is....

Jul 02
PHP Secure fie uploading

Hear I'm going to share a easy and secure way to upload your images and other files. You have to be....

Aug 12
Error Handling | Python Programming

Errors are absolutely normal when programming. You may get hundred of errors while learning. Not....

Replying to 's comment Cancel reply
ABOUT AUTHOR
Thilan Danushka Dissanayaka

Thilan Dissanayaka

Hi, I'm Thilan from Srilanka. An undergraduate Engineering student of University of Ruhuna. I love to explorer things about CS, Hacking, Reverse engineering etc.

CATEGORIES
SOCIAL
RANDOM ARTICLES