Termux技巧

1、安装

不要用google app store的,从fdroid下载,先安装termux-api,然后安装termux主包,反过来会导致api安装失败。

2、换源

termux-change-repo

3、安装ssh

pkg install openssh

sshd如果报错的话,可以尝试执行ssh-keygen -A

配置文件在$PREFIX/etc/ssh/sshd_config​

默认端口8022

4、安装cron

pkg install cronie termux-services

sv-enable crond 【需要加入到.bashrc中】

crontab -e

5、伪开机启动项

修改.bashrc

加入

sshd

sv-enable crond

6、修改欢迎界面

可以修改此文件,$PREFIX/etc/motd

_____
|_   _|__ _ __ _ __ ___  _   ___  __
  | |/ _ \ '__| '_ ` _ \| | | \ \/ /
  | |  __/ |  | | | | | | |_| |>  <
  |_|\___|_|  |_| |_| |_|\___</_/\_\

7、备份和还原

备份
termux-setup-storage
tar -zcf /sdcard/termux-backup.tar.gz -C /data/data/com.termux/files ./home ./usr
还原
termux-setup-storage
tar -zxf /sdcard/termux-backup.tar.gz -C /data/data/com.termux/files --recursive-unlink --preserve-permissions


参考 https://wiki.termux.com/wiki/Backing_up_Termux

8、wifi等问题

wifi锁屏后可能会断开,主要是安卓的省电策略,可以尝试利用termux-wake-lock;如果是测试机的话,也可以用开发者模式的Stay Awake选项。

目前没有找到特别合适的方式

9、termux-API

https://zhuanlan.zhihu.com/p/381044910

Leave a Reply

Your email address will not be published. Required fields are marked *