下载安装

官网 & F-Droid & Github

扩展功能

1
2
mkdir -p ~/.termux && echo "extra-keys = [['ESC','/','-','HOME','UP','END','PGUP','DEL'],['TAB','CTRL','ALT','LEFT','DOWN','RIGHT','PGDN','BKSP']]" > ~/.termux/termux.properties
termux-reload-settings

软件包管理

1
2
3
4
5
6
7
8
9
10
pkg search <query>              # 搜索包
pkg install <package> # 安装包,pkg i
pkg uninstall <package> # 卸载包
pkg reinstall <package> # 重新安装包
pkg update # 更新源
pkg upgrade # 升级软件包
pkg list-all # 列出可供安装的所有包
pkg list-installed # 列出已经安装的包
pkg show <package> # 显示某个包的详细信息
pkg files <package> # 显示某个包的相关文件夹路径

更换国内源

1
2
3
4
5
6
echo "deb https://mirrors.ustc.edu.cn/termux/apt/termux-main stable main" >  $PREFIX/etc/apt/sources.list
echo "deb https://mirrors.tuna.tsinghua.edu.cn/termux/termux-packages-24 stable main" > $PREFIX/etc/apt/sources.list
echo "deb https://mirrors.tuna.tsinghua.edu.cn/termux/science-packages-24 science stable" > $PREFIX/etc/apt/sources.list.d/science.list
echo "deb https://mirrors.tuna.tsinghua.edu.cn/termux/game-packages-24 games stable" > $PREFIX/etc/apt/sources.list.d/game.list
https://mirrors.tuna.tsinghua.edu.cn/termux/termux-root-packages-24/
pkg up

常用工具安装

1
pkg i curl wget tree vim nano tmux htop

Oh My Zsh

安装配置

1
2
3
4
pkg i zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
sh -c "$(wget -O- https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
chsh -s zsh

修改主题

1
2
sed -i '/^ZSH_THEME=/c\ZSH_THEME="ys"' ~/.zshrc
source ~/.zshrc

安装插件

1
2
3
4
5
6
7
8
9
10
11
12
pkg i -y git
## 安装 zsh-syntax-highlighting(代码高亮)
git clone https://github.com/zsh-users/zsh-syntax-highlighting $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
## 安装 zsh-autosuggestions(自动建议)
git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
## 安装 zsh-completions(自动补全)
git clone https://github.com/zsh-users/zsh-completions $ZSH_CUSTOM/plugins/zsh-completions
## zsh-com­ple­tions 插件还需把 autoload -U compinit && compinit 添加到.zshrc。输入命令可一键添加:
[ -z "`grep "autoload -U compinit && compinit" ~/.zshrc`" ] && echo "autoload -U compinit && compinit" >> ~/.zshrc
## 把需要启用的插件写入到配置文件中,使用 sed 命令一键操作
sed -i '/^plugins=/c\plugins=(git z zsh-syntax-highlighting zsh-autosuggestions zsh-completions)' ~/.zshrc
source ~/.zshrc

更多配置

修改问候语

1
2
vi $PREFIX/etc/motd
touch ~/.hushlogin

root 权限

1
2
3
4
5
6
## 安装 tsu
pkg i tsu
## 使用 root 权限执行命令
tsudo <command>
## 切换到 root 用户
tsu

访问外部存储

1
2
3
4
5
6
7
8
9
termux-setup-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

通过 /sdcard 来访问外部存储的根目录

SSH 连接

1
2
pkg i openssh
ssh User@Host -p Port

附录

Termux:Styling
https://blog.upx8.com/3587
https://blog.upx8.com/3588