Termux,a free and open source terminal emulator for Android which makes a Linux environment in Android.You can use this application on your Android phone to learn cooding, Ethical hacking, penetration testing and many more.Termux can be downloaded for free from Google play store or F-Droid.In my previous post I have narrated what is termux and how to install its latest version.This tutorial is about termux basic command list I have mentioned almost every commands of Termux from basic label to advanced.
~Get fire effect on Termux~
Let's say before we start,if you do any spelling mistake you may have to face some error problems so use these commands carefully to avoid any errors.
And ,As Termax is a Linux environment, almost all commands will be the same as the Linux commands.
Termux basic command list
Command |
usage |
clear |
Clear the screen |
uname |
Get information about kernal,OS,Hardware |
pwd |
Print the present working directory |
cd |
Change directory |
ls |
Print the name of all contents under a directory |
cat |
Print the contents of a file |
cp |
copy files or folders |
mv |
move files from one directoy to another |
mkdir |
Create a new directory |
rm |
Delete or remove a file or folder |
touch |
Create a new file |
echo |
print something on termux screen |
ifconfig |
Configure the status of network interfaces |
chmod |
Change the permission of a file |
pkg install [package name] |
Install new packages on termux |
git clone |
Make a clone of an existing git repo |
ps |
Display the current running process |
history |
Prints the list of all previously executed commands |
1.clear screen command in termux
The first time you open the Termax application, you'll see some text on the screen that might be annoying for you.The relevant command to clear screen is clear.
Besides the clear command you can use CTRL+l to clear the screen.
2.uname command in termux
uname command in termux is used to get information about kernal , operating system and hardware.To display kernal name use the command uname.
You can get more information about system architecture by adding parameters.
Command |
System Details |
uname -s |
Kernal name |
uname -r |
kernal release |
uname -v |
kernal version |
uname -n |
nodename |
uname -m |
Hardware name |
uname -i |
Hardware platform |
uname -p |
Processor name |
uname -o |
Operating System |
uname -a |
All information |
3.pwd command in termux
As like Linux OS pwd command is used to print the present working directory or current working directory.pwd command prints the full path of the current directory and all directories are separated by the /(slash) symbol.
$ pwd
/data/data/com.termux/files/home
4.cd command in termux
cd command in termux is used to change the directory.It requires either the full path or the name of the directory.
Let's assume that we are present at /data/data/com.termux/files/home and photos is a subdirectory of home and we want to change our directory to photos ,to do so we have to enter the command cd photos
$ pwd
/data/data/com.termux/files/home
~ $ cd photos
And again if you want to change the directory from photos to home you have to enter the command cd ..
$ pwd
/data/data/com.termux/files/home/photos
$ cd ..
$ pwd
/data/data/com.termux/files/home
cd .. command is used to move one directory up
Command |
usage |
cd |
to change the directory in forward |
cd .. |
to move one directory up |
cd ~ |
To reach the home directory |
5.ls command in termux
ls command is used to print the name of all contents under a directory also it can print all the file and folders name with details.by default ls prints the name of all contents of current working directory if you want to print the details of other directors you have to give the path of the directory.
~ $ pwd
/data/data/com.termux/files/home
~ $ ls
new.txt photos videos
Here ls prints the all contents of the home directory . To print the contents of files we have to enter the command
~ $ ls /data/data/com.termux/files
home usr
Also you can use some flags with ls commands
Command |
usage |
ls -R |
list files recursively |
ls -s |
list files with their sizes |
ls -l |
list files in ling format |
ls -a |
list files including hidden files |
ls -t |
list files short by date and time |
6.cat command in termux
The cat command is used in termux to print the contents of a file onto the standard put stream. Although it can be used to write something into a file or create a new file.
Let's assume that we have a txt file demo.txt inside our home directory and we are interested to know the contents of demo.txt file then we have to use the command 👇
~ $ ls
demo.txt photos videos
~ $ cat demo.txt
its a demo content
And to add a new line to the demo.txt file we have to use the Syntex cat >> demo.txt and write the new line then press CTRL+D
$ cat >> demo.txt
new line added
~ $ cat demo.txt
its a demo content
new line added
7.cp command in termux
cp is the very frequently used command in termux ,it is used to copy any file or folder from the present working directory to the another directory.
Inside our home directory we have a file named demo.txt and we want to copy this directory to our files directory ,to do so we have to use the command cp demo.txt /data/data/com.termux/files
ls
demo.txt photos videos
~ $ cp demo.txt /data/data/com.termux/files
~ $ cd /data/data/com.termux/files
.../com.termux/files $ ls
demo.txt home usr
8.mv command in termux
mv command in termux is used to move any file or folder from one location to another and to rename any file or directory.
The Syntex is
mv [option] source destination
for example to move the file demo.txt from home to the videos directory we have to use the command mv demo.txt videos
$ ls
demo.txt photos videos
~ $ mv demo.txt videos
~ $ cd videos
~/videos $ ls
demo.txt
To rename a file the command will be mv [old file] [new file]
$ ls
abc xyz
~ $ mv abc xyz
~ $ ls
xyz
9.mkdir command in termux
mkdir command allows the user to create a directory or multiple directories in the present working directory or inside any other directory.
The Syntex of this command is
mkdir [option] newdirectory
$ mkdir newdir
~ $ ls
newdir
10.rm command in termux
rm command is used to remove a file or folder permanently from termux.After removing a file from Termux it can't be recovered So be very careful before using this command.
By default ,this command can remove the files only
~$ ls
a.txt rose
~ $ rm a.txt
~ $ ls
rose
To remove the directory you have to add some flags
~$ ls
rose
~ $ rm -r rose
~ $ ls
~ $
There are variations you can use with the rm command
Command |
usage |
rm [filename] |
used to delete a file |
rm -r [filename] |
used to delete directory(recursively) |
rm -i [filename] |
interactively file removing |
rm -rf [filename] |
remove a directory with force |
11.touch command in termux
touch command is used in termux to create, change and modify timestamps of a file.although it can be used to create an empty file in Termux.
12.echo command in termux
echo command is used to print something on Termux screen.It can print the outputs of the strings that are passed to it as arguments.
As an instance if we want to print the message "Hallow world" on our termux screen using echo command then we have to use the command echo "Hallow world"
$ echo "Hallow World"
Hallow World
This command is also used to to add some data in a file. As like we can add the text "Practice makes man perfect" to the file new.txt using the echo command.
$ echo "practice makes man perfect" >> new.txt
~ $ ls
new.txt test
~ $ cat new.txt
practice makes man perfect
13.ifconfig command in termux
Interface configuration in short ifconfig command in termux is used to configure and view the status of the network interfaces.Easily you can find out your public and private IP address using ifconfig command in termux.
14.chmod command in termux
chmod is an another useful command for termux this command is used to change the file permissions (read, write, execute) in termux.
As an example:
To give the execute permission of a file (for owner) you have to enter the command
chmod +x <file name>
And to take out the execute permission you have to enter the command chmod -x <file name>
Command |
usage |
chmod +rwx filename |
to add permissions |
chmod -rwx directoryname |
to remove permissions |
chmod +x filename |
add executable permission |
chmod -x filename |
remove executabe permission |
15.pkg install command in termux
pkg install command allows the user to install new packages from package repository or local multiple packages can be installed at a time using the pkg install command. The Syntex of this command is
pkg install <package name>.
As an example :To download python on Termux we have to enter the command
pkg install python
16.git clone command in termux
git clone command is used in termux to make a clone of an existing git repository. The target repository can be remote or local.
The git clone command Syntex is git clone <git url of the package>
git clone https://github.com/TechnicalB9T/Termux-AI.git
17.ps command in termux
ps command is used to display the currently running process. This command helps the user to better understand that how many processors are running in the background of the application and which can be terminated .
$ ps
PID TTY TIME CMD
21522 pts/0 00:00:00 ps
24748 pts/0 00:00:00 bash
18.termux-setup-storage
If you want to share files from phone storage to Termux after installing the Termux application, you cannot do so without Termux storage permission.termux-storage-permission command is used to grant storage permission to termux.
19.history command in termux
history command in termux is used to print the list of all previously executed commands.
20.exit command in termux
exit command is used to close the termux application.
Conclusion
In this tutorial I have explained almost all basic termux commands as well as advanced commands step by step with example.I think you don't need to go anywhere after this article.You can visit our YouTube channel to gain more knowledge about termux and its usage.
0 Comments