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:
termux
termux:api
(expose basic android functionalities)termux:boot
(allows programs to be run at boot)termux:widget
(adds shortcuts totermux
scripts and commands on the home screen)
-
In
termux
, install thetermux-api
package:
config¶
-
In
termux
, make suretermux-api
can access SMS, contacts and location: -
In your android home screen, swipe left to access your launcher's widget menu -> edit -> add widget ->
termux
widget (now yourtermux
widgets will appear in thetermux
section)
use¶
basic termux
commands¶
-
search
termux
packages: -
install
termux
packages: -
update
termux
packages: -
remove
termux
packages:
access to termux
via ssh over local WiFi¶
-
In
termux
, run$ whoami
to get your user name -
In
termux
, run$ passwd
to setup your user password -
In
termux
, run$ ifconfig
to get your local IP (on the same WiFi that your GNU/Linux distro) -
In
termux
, installopenssh
:$ pkg install openssh
-
In
termux
, run$ sshd
in order to startup your ssh server ($ pkill sshd
to stop it) -
In GNU/Linux, run
$ ssh -p 8022 user-name@local-ip
in 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
termux
via ssh over local WiFi, but in GNU/Linux: instead of running$ ssh -p 8022 user-name@local-ip
run the following:
automatic and periodic backup via rsync
¶
-
In
termux
, installrsync
andopenssh
: -
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-scheduler
instead 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
), installcronie
and 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.