⇢ blog 2003 2004 2005 2006 2007 2008 2017 2018 2019 2020
⇢ tech android linux vim
Tags: software termux android debian apt-get
- Backup Termux
- Clover's Favourite packages
- Running programs or services at boot
- SD card access
- Terminal bell
- Toggle extra keyboard row
- Using apt-cacher-ng
You may use tar to backup your Termux installation for migration to other devices, or simply as a precaution. (Be sure to install the 'tar' package before doing so, and close and restart Termux. Otherwise busybox will repeatedly fail on the --owner/--group flags, as it doesn't support them.)
$ cd /data/data/com.termux/files $ tar -cvzf /sdcard/Download/termux.tgz --owner=0 --group=0 home usr
$ cd /data/data/com.termux/files $ tar -xvzf /sdcard/Download/termux.tgz
Upon closing and re-running Termux, you should now have a restored version of your previous environment.
Note that if you have KDEConnect or GNOME connect installed, you can use those to transfer your backup to a desktop/laptop system for safekeeping. (I use rsync, but that's personal preference.)
Stuff I install almost each and every time (your needs will be different, I can almost guarantee it):
apt-get install bc bmon diffutils dnsutils ffmpeg file gawk htop \ imagemagick less lynx neofetch nmap openssh perl procps rsync \ screen subversion util-linux vim wget termux-am termux-api \ termux-auth termux-exec termux-tools
To run things at boot, you need to create a directory and add simple scripts to it, which Termux will run as it opens.
$ mkdir -p ~/.termux/boot $ touch ~/.termux/boot/start
A few examples, are set up a script to always take wake-lock so programs stay running in the background, and start sshd and crond.
$ chmod +x ~/.termux/boot/start $ vim ~/.termux/boot/start # set wake lock termux-wake-lock # run crond if it isn't already running pgrep crond || crond # run sshd if it isn't already running (commented out unless needed) #pgrep sshd || sshd :wq
The next time it is started, these programs should auto-run. If you want to trigger it manually, you may, as it's a simple shell script.
If you use apt-cacher-ng to save bandwidth, as I do, ensure that Termux uses apt-cacher-ng's proxying services by editing ~/../usr/etc/apt.conf. Add the correct IP or hostname:
$ vim ../usr/etc/apt.conf Acquire::http::Proxy "http://192.168.0.5:3142"; APT::Keep-Downloaded-Packages "true"; #APT::Install-Recommends "false";
Owing to the fact that apt-cacher-ng doesn't support https (because it can't), we'll also need to change ~/../usr/etc/apt/sources.list like so:
$ vim ../usr/etc/apt/sources.list # The main termux repository: #deb https://termux.net stable main deb http://termux.net stable main
Once done, re-run
apt-get update && apt-get upgrade. You should see the repo appear and begin to populate on your cacher's filesystem.
Termux comes with a neat feature to give you soft-key access to some keys that would not normally be available. If you use a keyboard that already has these (such as Multiling OKeyboard), then it's not of much use and simply takes up screen real estate.
To disable or enable it, swipe from the left of your screen to open the session manager tray. Press and hold on the Keyboard toggle, and it will hide/show the key bar.
If you don't like terminal feed back, you can disable it with ~/.termux/termux.properties
Removing the line should cause Termux to pulse the vibrator motor, and if you like an audible bell, you can do this instead:
Termux is a prefixed Linux installation, and thus it cannot access some or all of the underlying Android OS without some additional work.
To set things up, you'll need to install termux-tools:
$ apt-get install termux-tools termux-api $ termux-setup-storage $ cd storage/ $ ls ./ dcim@ external-1@ music@ shared@ ../ downloads@ movies@ pictures@ $ ls shared/ ./ Documents/ Podcasts/ bluetooth/ ../ Download/ Ringtones/ crosswords/ 'Acrylic Paint'/ Movies/ TWRP/ eve.st.zip Alarms/ Music/ Telegram/ osmdroid/ Android/ Notifications/ apk/ s/ DCIM/ Pictures/ backups/ s_html/