This document is a WORK IN PROGRESS.
This is just a quick personal cheat sheet: treat its contents with caution!
termux¶
termux is an Android terminal emulator and Linux environment application that works directly with
no rooting or setup required. A minimal base system is installed automatically, additional packages
are available using the package manager (with a dedicated termux APT repository.
Reference(s)
- https://wiki.termux.com/wiki/Main_Page
- https://wiki.termux.com/wiki/FAQ
- https://github.com/termux/
- https://github.com/termux/termux-app
- https://github.com/termux/termux-packages
- https://f-droid.org/en/packages/com.termux/
- https://f-droid.org/en/packages/com.termux.api/
- https://f-droid.org/en/packages/com.termux.boot/
- https://f-droid.org/en/packages/com.termux.widget/
table of contents¶
install¶
-
Install:
termuxtermux:api(expose basic android functionalities)termux:boot(allows programs to be run at boot)termux:widget(adds shortcuts totermuxscripts and commands on the home screen)
-
In
termux, install thetermux-apipackage:
config¶
-
In
termux, make suretermux-apican access SMS, contacts and location: -
In your android home screen, swipe left to access your launcher's widget menu -> edit -> add widget ->
termuxwidget (now yourtermuxwidgets will appear in thetermuxsection)
use¶
basic termux commands¶
-
search
termuxpackages: -
install
termuxpackages: -
update
termuxpackages: -
remove
termuxpackages:
access to termux via ssh over local WiFi¶
-
In
termux, run$ whoamito get your user name -
In
termux, run$ passwdto setup your user password -
In
termux, run$ ifconfigto get your local IP (on the same WiFi that your GNU/Linux distro) -
In
termux, installopenssh:$ pkg install openssh -
In
termux, run$ sshdin order to startup your ssh server ($ pkill sshdto stop it) -
In GNU/Linux, run
$ ssh -p 8022 user-name@local-ipin order to connect -
OPTIONAL: In
termux, create widgets shortcuts to start and stopsshd:
access to termux via ssh over USB¶
Prerequisite
- The procedure is almost the same than for accessing
termuxvia ssh over local WiFi, but in GNU/Linux: instead of running$ ssh -p 8022 user-name@local-iprun the following:
automatic and periodic backup via rsync¶
-
In
termux, installrsyncandopenssh: -
In
termux, generate a RSA key pair and share the public key with your server: -
In
termux, create this script:$ mkdir -p $HOME/scripts $ vi $HOME/sync-android-with-server > #! /data/data/com.termux/files/usr/bin/bash > > mkdir -p $HOME/.tmp > mkdir -p $HOME/.logs > > rsync --archive --compress --human-readable --progress $HOME/storage/dcim/OpenCamera server-user@server-ip:/path/to/android/backup >| $HOME/.logs/last-rsync-cam.log > > termux-sms-list >| $HOME/.tmp/termux-sms-list > > rsync --archive --compress --human-readable --progress $HOME/.tmp/termux-sms-list server-user@server-ip:/path/to/android/backup >| $HOME/.logs/last-rsync-sms.log > > termux-contact-list >| $HOME/.tmp/termux-contact-list > > rsync --archive --compress --human-readable --progress $HOME/.tmp/termux-contact-list server-user@server-ip:/path/to/android/backup >| $HOME/.logs/last-rsync-contacts.log > > #termux-location >| $HOME/.tmp/termux-location > > #rsync --archive --compress --human-readable --progress $HOME/.tmp/termux-location server-user@server-ip:/path/to/android/backup >| $HOME/.logs/last-rsync-location.log > $ chmod +x sync-android-with-server -
OPTIONAL: In
termux, you can create a widget shortcut to trigger the previous script manually: -
Install
termux-job-schedulerinstead ofcronie(for Cron), in order to get periodic scripts execution without having to prevent the device from sleeping, e.g. with the previous script (every hour, even after reboots):
misc¶
- In
termux, installrunnit(termux-services), installcronieand enable it, and edit yourcrontab:
TODO¶
- extract apps list
If this cheat sheet has been useful to you, then please consider leaving a star here.