what is Termux?
Termux is a free and open-source terminal emulator for Android which allows for running a Linux environment on an Android device. In addition, various software can be installed through the application's package manager.
Why Use Termux?
There are already some apps in the Play Store that are Android ports of Linux applications. These differ from Termux because they replicate those Linux apps, but they're made in an "Android way."
In contrast, Termux is a self-contained Linux environment. Its programs are (for all intents and purposes) the same as their Linux counterparts. This conveys some advantages over the ported application
How to Use Termux
When you're ready, grab your phone or tablet and install Termux.
Download: Termux
Basic Termux Commands You Should Know
apt update
apt upgrade
Next, find out what apps are available:
apt listTo find out more about one of these packages, use
apt show [package name]This will display the name, maintainer, file size, dependencies, and other valuable details. To install an app, simply use the following:
apt install [package name]Our guide to using APT will tell you more about this tool, such as how to upgrade packages. You can run an installed tool by entering its name at the Terminal prompt in the Termux command line.
In addition to apt, this list of built-in commands works in Termux on Android:
lets you copy a filecp
will move a filemv
lists the contents of a directoryls
deletes (removes) datarm
creates a symbolic link (for example,lnln /data/data/com.termux/files/home/documents to /sdcard/Documents1. Command for show list of files in the directory.
ls
ls = list of files or folders. This command will show you a list of available files and folders in your directory.
ls -a
If you type the 'hyphen a after the 'ls' command it will show a list of hidden files in your directory.
2. Command for change directory.
cd
cd = change directory. This command is useful for changing a directory in your termux or going into a particular directory in termux.
To use the 'cd' command you must have to specify the name of the directory after 'cd'. eg: If you want to go into the 'storage' directory you have to type the command,
cd storage
To go to the home directory of termux you have to type '$HOME' after the 'cd' command
cd $HOME
3. Command for printing the current working directory.
pwd
PWD = print working directory. This command is useful for finding the address of your current working directory. This command will print the address of your directory.
4. Command for creating a new directory in termux.
mkdir
mkdir = make directory. This command is useful for making a new directory in termux.
To use this command you must have to define the name of the directory with the 'mkdir' command. eg: If you want to create a new folder named 'TermuxTool' you have to type the command,
mkdir TermuxTool
5. Command for removing directory in termux.
rmdir TermuxTool
rmdir = remove directory. This command is useful for removing directories in termux. You must have to specify the name of the directory after the 'rmdir' command.
This command will only work for removing empty directories.
6. Commands for removing files and directories.
rm filename.txt
rm = remove. This command is useful for removing files in Lemieux. This command is only for removing files it won't work for removing the directories. Also, you have to specify the name of the file after the 'rm' command.
rm -r TermuxTools
rm -r = remove a directory with files. This command is useful for removing or deleting a directory with all files in the directory.
rm -rf TermuxTools
rm -rf = forcefully remove a directory with files.
7. Commands to give permission to file or directory.
chmod
chmod = change mode. This command is useful for giving running permission to particular scripts or files.
chmod +x script.sh
This command is useful for giving permission to the particular script like 'script. sh'.
chmod +x *
This command is useful for giving permission to all files available in your directory. In this command, you don't need to specify the name of the file.
chmod 777 TermuxTool
This command is useful for giving all permission to the directory with all files in the directory. Full Access!
8. Commands for copy files in termux.
cp filename path
cp = copy. This command is useful for copying a particular file and pastes to a particular location.
To use the 'cp' command you must have to specify a file name after 'cp' and after the filename, you have to specify the path where you want to paste this file.
eg: If you want to copy the 'wordlist.txt' file and paste it into the '/data/data/com.termux/files/home' path you have to type the following command. You can find the path name by the 'PWD' command.
cp wordlist.txt /data/data/com.termux/files/home
9. Command for move file in termux.
mv filename path
mv = move. This command is useful for moving the particular file to a particular location.
The use of the 'mv' command is the same as the 'cp' command.
10. Command for renaming any file or directory in termux.
The 'mv' command is also used for renaming files in Lemieux.
eg: If you want to rename the 'script. sh' file to 'install. sh,' you have to follow command.
mv script.sh termux.sh
After the mv command type, the original name of the file then types the name that you want to rename.
11. Command for clear temrux screen.
clear
This command is useful for clear text from the screen.
12. Command for exit termux session.
exit
This command is useful for close termux. If you are running more than one temrux session you have to type this command multiple times for exit termux.
If you want to stop or close a particular running script or tool you have to press the Ctrl+C button. You will find the 'Ctrl' button below the termux and above the keyboard.