Github Com
Github Com
kyo1337 / Termux
forked from Towha/Termux
master
Termux / README.md
1 contributor
Raw Blame
426 lines (379 sloc) 21.5 KB
The termux app itself is same but the signature is different so you can't use the Play
store version with termux styling from F‐Droid.but if you download both termux
and termux styling from F‐Droid you can use both.Termux from F‐Droid has free
styling so I suggest to use it from F‐Droid.
bash <(curl ‐fsSL https://git.io/JvMD6)
Swipe right from the left edge of the screen to drag out the navigation bar, where you
can create, switch, rename sessions, and bring up input methods.
Common shortcut keys
When using the terminal, you need to use the Alt, Ctrl, Esc and other keys, but these
keys are not available on the phone.
In Termux, you can use the volume down button to simulate the Ctrl key. For example,
volume + L is equivalent to pressing Ctrl + L on the keyboard.
The following are some of the shortcuts commonly used in the terminal, and they also
work in Termux.
Ctrl + A‐> cursor to start position
Ctrl + E‐> cursor to the end
Ctrl + K‐> Cut everything from here to the end
Ctrl + U‐> Cut everything from here to the beginning
Ctrl + W‐> Cut here to the left
Ctrl + W‐> Cut here to the left
Ctrl + Y‐> Paste words cut by Ctrl + U, Ctrl + D, Ctrl + W
Ctrl + L‐> equivalent to clear command, clear screen
Ctrl + C‐> terminate process / command
Ctrl + D‐> close terminal
Ctrl + Z‐> Suspend (send SIGTSTP to) the current process
The volume plus button can be used as a special key to generate a specific input, which ca
Volume + E‐> Esc
Volume + T‐> Tab
Volume + 1‐> F1 (Volume increase + 2 is equivalent to F2, and so on)
Volume +0‐> F10
Volume + B‐> Alt + B, return a word when using readline
Volume + F‐> Alt + F, forward a word when using readline
Volume + X‐> Alt + X
Volume + W‐> Up Arrow
Volume + A‐> Left Arrow
Volume + S‐> Down Arrow
Volume + D‐> Right Arrow
Volume + L‐> | (pipe character)
Volume + H‐> ~ (tilde character)
Volume + U‐> _ (underscore character)
Volume + P‐> Page Up (previous page)
Volume + N‐> Page Down (next page)
Volume +.‐> Ctrl + \ (SIGQUIT)
Volume + V‐> Show volume control
Volume + Q‐> Show extra button view
Volume + K‐> Ibid
In addition, the function keys can be moved to the left to call up the text input box,
which can more conveniently paste and modify the instructions to be entered more
finely.
Package management
In addition to supporting the apt command, Termux also encapsulates the pkg
command. The pkg command is backward compatible with the apt command. The
official recommendation is to use the pkg command, because it will automatically
update the apt list when installing or upgrading the package, which means that
performing pkg upgrade is equivalent to performing apt update && apt upgrade, which
simplifies the operation process.
$ tree ‐d ‐L 1 $PREFIX
/data/data/com.termux/files/usr
├── bin
├── etc
├── include
├── lib
├── libexec
├── share
├── src
├── tmp
└── var
$ echo $HOME
/data/data/com.termux/files/home
$ ls /
ls: cannot open directory '/': Permission denied
You can install proot for this and use the termux‐chroot command to simulate the
root environment and the standard Linux directory structure.
$ pkg i ‐y proot
$ termux‐chroot
$ ls /
bin data dev etc home lib proc root sbin share storage system tmp usr var ve
$ ls /usr
bin etc include lib libexec share src tmp var
This can be useful for some programs that must use a standard path.
root authority
After all, the proot mentioned above is a simulation method, which will have certain
limitations. If the phone is already rooted, although you can switch to root by using su
in Ter rootmux, some Ter 但是 mux commands will not work properly. After all, this is
not a standard Linux environment. The solution is to install tsu for root privileges, tsu is
an alternative to su in Termux.
Install tsu:
pkg i ‐y tsu
tsudo command
tsu
Under the root user, enter the exit command or press Ctrl + D to return to the normal
user.
termux‐setup‐storage
This will create the $ HOME / storage directory, and subdirectories in this directory
will be symbolically linked to some common directories in phone storage.
$ tree storage
storage
├── dcim ‐> /storage/emulated/0/DCIM
├── downloads ‐> /storage/emulated/0/Download
├── movies ‐> /storage/emulated/0/Movies
├── music ‐> /storage/emulated/0/Music
├── pictures ‐> /storage/emulated/0/Pictures
└── shared ‐> /storage/emulated/0
You can also access the root directory of external storage through / sdcard.
SSH connection
As a Linux terminal or server, SSH is required. Whether you are SSHing to Termux or
using Termux to connect to other hosts, you need to install openssh first.
pkg i ‐y openssh
Termux uses SSH to connect to other hosts Basic operation, ssh command:
ssh User@Host ‐p Port
SSH to Termux
After all, the mobile phone is too restrictive to operate, and it is very elegant to operate
through a SSH connection on the computer.
set password:
passwd
View username:
whoami
Since Termux is a single‐user environment, this step is not necessary. You can log in
using any username. View IP address:
ifconfig
sshd
The SSH server program is not started by default, and it needs to be restarted every
The SSH server program is not started by default, and it needs to be restarted every
time the application is closed and opened. I will explain how to start the SSH server
later. Gathering the three elements of SSH, you can now enter ssh commands in a
computer terminal or use other SSH clients to connect. Note that Termux's SSH port is
8022.
ssh User @ Host ‐p 8022
After executing the ssh command, you can enter the password to connect, and
then you can easily perform various operations on the computer.
Configure SSH key login If you need to expose Termux's SSH port to the public
network, it is recommended to configure key login for security.
SSH server ﴾sshd﴿ starts automatically If you do not want to enter Termux every time
ssh connects and enter the sshd command, you can set it to start automatically.
There are two cases of sshd self‐starting, one is when the Termux application is
opened, and the other is when the phone is turned on.
Start the SSH server automatically when opening the application Just add the sshd
command to the shell configuration file. For example, if I use zsh, add it to ~ /
.zshrc. If it's bash, add it to ~ / .bashrc.
echo "sshd" >> ~/.zshrc
Create ~ / .termux / boot / directory ﴾the scripts placed in this directory will be
executed after booting Termux﴿.
mkdir ‐p ~/.termux/boot/
Create a new script in this directory, named start‐sshd, and add the sshd command
to this file.
echo 'termux‐wake‐lock; sshd' > ~/.termux/boot/start‐sshd
The termux‐wake‐lock command prevents the process of the Termux application from
freezing when the phone is sleeping. After the setting is completed, the phone will
automatically start Termux and start the SSH server.
Here we used AnLinux Is an app that helps users install Linux distributions in Termux. It
is a guide, its essence is to give you a line of installation instructions for you to execute
according to the distribution of your choice. It's very easy to follow the instructions in
the app, so I won't go into details here.
Custom extended function buttons
The default function buttons are too simple and do not have the left and right arrow
keys, which is not convenient to use. Fortunately you can ~/.termux/termux.properties
customize the key configuration file.
If you want to set it up like this, you can add the following to the configuration file:
extra‐keys = [['ESC','/','‐','HOME','UP','END','PGUP','DEL'],['TAB','CTRL','ALT','LEFT','DO
Finally, enter the following command to reload the configuration, or close the
application and then open it again.
termux‐reload‐settings
Replace domestic software source
By default, the software package download speed is very slow. You can speed up the
software package download speed by replacing the domestic software source.
cp $PREFIX/etc/apt/sources.list $PREFIX/etc/apt/sources.list.bak
sed ‐i 's@^\(deb.*stable main\)$@#\1\ndeb https://mirrors.tuna.tsinghua.edu.cn/termux stabl
You can also enter apt edit‐sources manually edited source files. Replace the default
official source with the mirror source of Tsinghua
University https://mirrors.tuna.tsinghua.edu.cn/termux.
Check modification:
$ cat $PREFIX/etc/apt/sources.list
‐The main termux repository:
‐deb https://dl.bintray.com/termux/termux‐packages‐24 stable main
deb https://mirrors.tuna.tsinghua.edu.cn/termux stable main
Last update:
pkg up
If the card progresses, exit the process of Termux, reopen it, and run dpkg ‐‐configure
‐a to repair it.
The above sentence comes from Oh My Zsh README, which means "pretend to
force is the first productivity".
Install zsh
pkg i ‐y zsh
Install Oh My Zsh
Download and install using curl
sh ‐c "$(curl ‐fsSL https://raw.githubusercontent.com/robbyrussell/oh‐my‐zsh/master/tools/i
sh ‐c "$(wget ‐O‐ https://raw.githubusercontent.com/robbyrussell/oh‐my‐zsh/master/tools/ins
Oh My Zsh will prompt you to set zsh as the default sehll after installation. If not
prompted, enter the following command to set it up:
chsh ‐s zsh
The theme I use is ys , it's simple and practical, not fancy. Use sed the command
to modify a key:
sed ‐i '/^ZSH_THEME=/c\ZSH_THEME="ys"' ~/.zshrc
After modification, enter the following command to refresh the configuration and you
can see the effect:
source ~/.zshrc
git clone https://github.com/zsh‐users/zsh‐syntax‐highlighting $ZSH_CUSTOM/plugins/zsh‐synt
git clone https://github.com/zsh‐users/zsh‐autosuggestions $ZSH_CUSTOM/plugins/zsh‐autosugg
git clone https://github.com/zsh‐users/zsh‐completions $ZSH_CUSTOM/plugins/zsh‐completions
[ ‐z "`grep "autoload ‐U compinit && compinit" ~/.zshrc`" ] && echo "autoload ‐U compinit &
The need to enable plug‐ins written to the configuration file, use the sedcommand to a
key operation.
sed ‐i '/^plugins=/c\plugins=(git z zsh‐syntax‐highlighting zsh‐autosuggestions zsh‐complet
If you have a plugin you want to add, write it in parentheses, and separate the plugin
names with spaces. Last applied configuration
source ~/.zshrc
$ tree ~/.termux
/data/data/com.termux/files/home/.termux
├── colors.properties
├── font.ttf
├── shell ‐> /data/data/com.termux/files/usr/bin/zsh
└── termux.properties
vi $PREFIX/etc/motd
And for someone like me who advocates minimalism, choose to keep it from showing.
touch ~/.hushlogin
cp bash.sh ~/.termux/tasker
If you don't see this directory then you need to install tasker and if you still don't
see it then mkdir ~/.termux/tasker . After that you can open tasker and select the
plugin option then select this script....﴾also you will need to have termux:tasker
installed﴿..
cron tab method So crontab won't run in the background if you close termux...this is
unless you disable battery optimization and allow wakelock..Now if you enable wakelock
the crontab service should work fine..Termux requires you to have wakelock or else cron
service won't work either.. you can try these commands for improvements in‐case you
meet with errors
pkg install termux‐services
sv‐enable crond
termux‐wake‐lock
with this crond should run absolutely fine but if it still doesn't then disable any power
save restrictions on termux..
tail
The first impression Termux gave me was that it was hard to use. I didn't even have the
left and right arrow keys, and I almost uninstalled. Because recent studies router, so they
try to enter Termux pkg install iperf3 to install iPerf3, I did not expect installed, and
then hold the phone over the house measured WiFi throughput. This also made me
interested in it, and then I started to understand it slowly. It was out of hand and
prompted me to try to customize it.
To be continued
© 2020 GitHub, Inc. Terms Privacy Security Status Help