本文汇总整理了在使用Termux过程中查看的资料、遇到的问题及其解决方法
需要的方法:
从Google商店下载安装Termux以及Termux:API
无需的方法:
从酷安网官网( https://www.coolapk.com/apk/com.termux )下载F-Droid;
从F-Droid下载安装Termux以及Termux:API
├── COPY:复制
├── PASTE:更多
├── More:更多
├── Select URL: 选择网址
└── Share transcipt: 分享命令脚本
└── Reset: 重置
└── Kill process: 杀掉当前终端会话进程
└── Style: 风格配色
└── Help: 帮助文档
显示隐藏式导航栏,可以新建、切换、重命名会话session和调用弹出输入法
Ctrl+A -> 将光标移动到行首
Ctrl+C -> 中止当前进程
Ctrl+D -> 注销终端会话
Ctrl+E -> 将光标移动到行尾
Ctrl+K -> 从光标删除到行尾
Ctrl+L -> 清除终端
Ctrl+Z -> 挂起(发送SIGTSTP到)当前进程
音量加+E -> Esc键
音量加+T -> Tab键
音量加+1 -> F1(和音量增加+ 2→F2等)
音量加+0 -> F10
音量加+B -> Alt + B,使用readline时返回一个单词
音量加+F -> Alt + F,使用readline时转发一个单词
音量加+X -> Alt+X
音量加+W -> 向上箭头键
音量加+A -> 向左箭头键
音量加+S -> 向下箭头键
音量加+D -> 向右箭头键
音量加+L -> | (管道字符)
音量加+H -> 〜(波浪号字符)
音量加+U -> _ (下划线字符)
音量加+P -> 上一页
音量加+N -> 下一页
音量加+. -> Ctrl + \(SIGQUIT)
音量加+V -> 显示音量控制
音量加+Q -> 显示额外的按键视图
pkg search 搜索包
pkg install 安装包
pkg uninstall 卸载包
pkg reinstall 重新安装包
pkg update 更新源
pkg upgrade 升级软件包
pkg list-all 列出可供安装的所有包
pkg list-installed 列出已经安装的包
pkg shoe 显示某个包的详细信息
pkg files 显示某个包的相关文件夹路径
termux-open test.ext
termux-open-url https://www.baidu.com
termux-info
termux-wake-lock
echo $HOME
/data/data/com.termux/files/home
├── downloads
├── storage
└── termux-ohmyzsh
echo $PREFIX
/data/data/com.termux/files/usr
├── bin
├── etc
├── include
├── lib
├── libexec
├── share
├── tmp
└── var
echo $TMPPREFIX
/data/data/com.termux/files/usr/tmp/zsh
使用zsh来替代bash作为默认shell(执行下面这个命令确保已经安装curl)
sh -c "$(curl -fsSL https://github.com/Cabbagec/termux-ohmyzsh/raw/master/install.sh)"
自定义配色:
vim .zshrc
.oh-my-zsh/themes
目录下放着oh-my-zsh所有的主题配置文件)修改motd文件内容
vim $PREFIX/etc/motd
Android6.0以上会弹框确认是否授权,执行这条命令确保termux在最前端(当前Activity)
termux-setup-storage
手机上一般经常使用手机QQ来接收文件,这里为了方便文件传输,直接在storage目录下创建软链接.
QQ:
ln -s /data/data/com.termux/files/home/storage/shared/tencent/QQfile_recv QQ
TIM:
ln -s /data/data/com.termux/files/home/storage/shared/tencent/TIMfile_recv TIM
更换Termux清华大学源
export EDITOR=vi
apt edit-sources
https://termux.net
官方源替换为http://mirrors.tuna.tsinghua.edu.cn/termux
手机没有root
下载proot工具:pkg install proot
输入termux-chroot
即可模拟root环境
在管理员身份下,输入exit
可回到普通用户身份。
手机已经root
安装tsu:pkg install tsu
输入tsu
即可切换root用户
apt update
apt install openssh
passwd
ssh-keygen -t rsa
cp TIM/id_rsa.pub ./.ssh
cat id_rsa.pub >> authorized_keys
whoami
获取用户名,再输入ifconfig
获得地址;sshd
开启服务;ssh 用户名@地址 -p 8022
连接,输入连接密码电脑:
vim /etc/ssh/sshd_config
Termux:
vim $PREFIX/etc/ssh/sshd_config
添加或去掉如下语句前的注释
UseDNS no
GSSAPIAuthentication no
电脑重启服务service sshd restart
,重启Termux
Write failed: Broken pipe
,此时需要重新用 ssh 命令进行连接。ssh -o ServerAliveInterval=60 用户名@地址 -p 8022
termux-battery-status: Get the status of the device battery.
termux-brightness: Set the screen brightness between 0 and 255.
termux-call-log: List call log history.
termux-camera-info: Get information about device camera(s).
termux-camera-photo: Take a photo and save it to a file in JPEG format.
termux-clipboard-get: Get the system clipboard text.
termux-clipboard-set: Set the system clipboard text.
termux-contact-list: List all contacts.
termux-dialog: Show a text entry dialog.
termux-download: Download a resource using the system download manager.
termux-fingerprint: Use fingerprint sensor on device to check for authentication.
termux-infrared-frequencies: Query the infrared transmitter's supported carrier frequencies.
termux-infrared-transmit: Transmit an infrared pattern.
termux-location: Get the device location.
termux-media-player: Play media files.
termux-media-scan: MediaScanner interface, make file changes visible to Android Gallery
termux-microphone-record: Recording using microphone on your device.
termux-notification: Display a system notification.
termux-notification-remove: Remove a notification previously shown with termux-notification --id.
termux-sensor: Get information about types of sensors as well as live data.
termux-share: Share a file specified as argument or the text received on stdin.
termux-sms-list: List SMS messages.
termux-sms-send: Send a SMS message to the specified recipient number(s).
termux-storage-get: Request a file from the system and output it to the specified file.
termux-telephony-call: Call a telephony number.
termux-telephony-cellinfo: Get information about all observed cell information from all radios on the device including the primary and neighboring cells.
termux-telephony-deviceinfo: Get information about the telephony device.
termux-toast: Show a transient popup notification.
termux-torch: Toggle LED Torch on device.
termux-tts-engines: Get information about the available text-to-speech engines.
termux-tts-speak: Speak text with a system text-to-speech engine.
termux-vibrate: Vibrate the device.
termux-volume: Change volume of audio stream.
termux-wallpaper: Change wallpaper on your device.
termux-wifi-connectioninfo: Get information about the current wifi connection.
termux-wifi-enable: Toggle Wi-Fi On/Off.
termux-wifi-scaninfo: Get information about the last wifi scan.
有时可能输入Termux API命令后无响应,其原因有可能是从两个不同的地方下载Termux以及Termux:API,如从Google商店下载Termux,再从F-Droid下载Termux:API,此时需要重新在同一个地方下载。
pkg install python python-dev