Have just installed termux app? Read this guide about how to use termux for beginner so that you can operate termux correctly.
In this guide you will learn:
Let’s get started.
Quoted from wikipedia, Termux is an Android terminal emulator and Linux environment application that works directly with no rooting or setup required. A minimal base system is installed automatically, additional packages are available using the package manager.
The termux application was created on May 30, 2015 by Fredrik Fornwall and was first released on Google Playstore on June 30, 2015.
Update Goole Playstore:
Termux in the google playstore has not received updates since September 29, 2020. This may cause errors when we use it. Recommendations from Dev termux, we can download the termux application from F-droid to avoid errors.
The size of the termux application is 102mb and will continue to grow according to the number of programs installed.
Well, now move on to the next lesson.
The termux application is divided into 3 parts.
The first part is a terminal.
terminal section contains all activities running in termux. In addition, in the terminal there is also a prompt (dollar logo). This prompt functions as a sign that termux is ready to accept commands.
The second part is an extra button.
This extra button helps us when operating termux. The extra keys that are most often used are the ctrl and arrow keys.
The third part is the keyboard.
To bring up the keyboard in termux we can press the screen once (tap). This keyboard function is to write commands in the termux terminal.
Before learning termux further, we must first know the terms in termux.
This term is a mention for a process, program, or other thing related to the termux application.
The following are basic terms that novice termux users should know.
Command is the line of code that contain some letters and characters to run termux from terminal.
For example exit, clear, cd, mkdir, etc.
The command must be written in the prompt termux.
Script or tools is a program that is installed and run in the termux application. This program is a cloned file from the github site.
Session is a window or tab in termux. We can run 2 or more processes in termux at once in different sessions. To bring up the session, swipe the screen from the left to the right side.
Actually, the key in learning termux is knowing the basic commands and their usage. Because whatever termux does is the result of the command we enter.
To enter commands we only need to type on the keyboard. And to run the command press enter.
Here I will enter and run the clear command whose function is to clear the terminal from text.
So I will write clear in the terminal and hit enter. The result, terminal screen become clean like image below.
Now you try to type the command yourself and run it in termux.
<name> must be typed following the command conditions.
For example mkdir <name>. The mkdir is command to create new folder. So <name> here means the name for new folder. If you want to create myskill folder, then the command is mkdir myskill.
For another commands, you can read on termux commands list article.
When we type a command, we must follow the applicable rules so that the command can be executed by termux without errors.
1. Command always use lowercase letter.
All commands must be written in lowercase. If there are capital letter in the command, termux will display an error ‘command not found’.
This rule applies only to command and does not apply to file/folder name, link, which is inserted.
The cd is command to open directory. If we type cd MyFolder1, that mean we open MyFolder1 directory.
cd represent command and MyFolder1 represent name of directory. So MyFolder1 doesn’t use lowercase.
2. Pressing enter after write the command
Enter on the keyboard has function to run commands that is written in the termux terminal. If you have written the command but don’t press enter, then termux will not do anything.
We can install the termux script by copying the script source code from github.
Github is a site that have function to store and manage project code. There are lots of projects on github specially made for termux.
To install the termux script from github, we have to enter the command git clone <name>.
Before we enter git clone <name>, we must installed the git package (pkg install git).
Ok, now I will try to give an example of installing the Hi Newbie termux script from github.
The code from the Hi Newbie script is stored at https://github.com/bookofmoon/hinew.
So, to install it, use the command below:
Then just wait for the installation process to complete (100%).
How do we know that the script have been installed?
Enter the ls command. If there is a folder with name of the script that we installed (hinew), it means that script has installed correctly.
Tips And Tricks:
Not all termux scripts come from github. Sometimes there are developers who store script code on other sites such as gitlab, pastebin, or personal site. And to install it, we have to follow the instructions that is written by developer on the script information.
After we have script on termux, the next step is runs that script.
To run the script, we must enter the execute command that compatible with the script programming language.
There are 3 programming language that is usually used on termux script.
The following is execute commands for every programming language script.
python <file name> for python language.
sh <file name> for bash language.
php <file name> for php language.
<file name> is represent the file that will be executed. And that file is called main file.
The main file usually has extension according to its programming language.
.py for python
.sh for bash
.php for php
Now look at the example below.
I have a program and its main file is start.py. Because it has .py extension, it means that file uses python programming language. So, to run start.py I must type python start.py and enter.
After the script is running, you have to follow what script order.
Use python2 start.py if python language on the file is 2.7 version (old version).
Now, let’s we run the Hi Newbie script that we installed before.
Usually, script or program that is installed from github, we must open the folder script to find the main file.
The folder of hi newbie script is hinew. So, we have to open it first with cd hinew command. After that, enter the execute command python hi.py and wait script running.
*hi.py is the main file of hi newbie script.
If it has run, follow the instructions that appear on terminal screen.
You will do the same in another script when you operate it.
In essence, to run the termux script installed from GitHub, we must first open the script folder and execute the script’s main file. After that, follow the script instructions.
Maybe you will find an error when you have just installed termux and you enter the command to install package or module (pkg install or pip install). That error is called termux base error.
How to solve it?
You should set the termux configuration. It has a function to avoid the termux base error.
Here’s what you have to do.
1. After you have just installed termux, enter the command to update and upgrade termux repository.
The command is:
apt update && apt upgrade -y
*You must enter that command when you have installed termux and open it for the first time.
2. Follow the command configuration.
When the command runs, you must enter data for the termux setup.
You must type Y or N on every process that requires your action, like the image below.
Tips And Tricks:
Just type Y and hit the enter button for all actions.
After finishing this setup, you can enter another command in terminal termux without getting an error. Then you can start your activity on termux.
Well, that is all about the guide on how to use termux for beginners. If you still understand yet, please leave a comment below.