Below are steps to configure Termux in android.
Download Termux from F-Droid as Google
App Store version is outdated due to reasons mentioned here
After installation, make sure every package is up to date. pkg update and pkg upgrade
- Accessing phone storage
- Enable remote login
- Run scripts on Termux bootup
- Termux Widget
- GPG and SSH Agents
- Setting up pass
- Choose Theme and font.
- Setting up shell
- Editors
- Video Downloads
- Neomutt
- Conclusion
Accessing phone storage
To access phone storage, you need to run termux-setup-storage
and click on allow Termux to access files on your
device. Now, if you do ls
in your home folder, you will see a folder with storage
which has folders of your phone
storage.
Enable remote login
Install pkg install openssh
and start ssh daemon sshd
to enable remote login.
You can find your username by whoami
, and you need to set your password using passwd
.
By default SSH port in Termux is 8022
. You can now SSH by using ssh -p 8022 username@your-phone-ip
.
Run scripts on Termux bootup
You can run scripts on boot up, you can install Termux:Boot from F-Droid and
now you can store the scripts in ` ~/.termux/boot/ to run at boot,
For example, if you start
sshd on startup, create
~/.termux/boot/start-sshd` with below content
#!/data/data/com.termux/files/usr/bin/sh
termux-wake-lock
sshd
Termux Widget
You can have shortcuts to scripts using Termux:Widget; you need to keep
your scripts in the ~/.shortcuts
directory. For example, if you want to start and stop sshd
on-demand, you can do like
below.
➜ .shortcuts ls
start-sshd stop-sshd
➜ .shortcuts more start-sshd
sshd
➜ .shortcuts more stop-sshd
pkill sshd
➜ .shortcuts
GPG and SSH Agents
Install OpenKeychain to manage your GPG keys.
And also, install OkcAgent, which makes OpenKeychain available in your Termux shell.
Make sure you have your GPG authentication key is available for SSH login to refer GPG Setup
to import your existing SSH private key to your GPG key. You need to install pkg install okc-agents
After the above step, you should be able to remote login to your servers and use git with SSH.
Setting up pass
pass is a password manager using a command-line interface.
You need to install gnupg
and git
before installing pass
.
pkg install gnupg
pkg install git
pkg install pass
Please refer this post to learn more about pass.
Choose Theme and font.
A long press on termux will give Copy, Paste, and more options. On clicking on
more
, you will get more options in that select Style
, and then you can Choose Color
and Choose font
to set Theme
and fonts.
Setting up shell
Install zsh and tmux. Please refer this post to learn more about customizing zsh.
pkg install zsh
pkg install tmux
Refer screenshot for zsh & tmux on Termux.
Editors
You can install vim
, neovim
& emacs
in Termux.
pip install fzf
pkg install vim-gtk
pkg install lua53
pkg install neovim
pkg install emacs
To setup
Refer to the screenshot on how neovim looks like in Termux.
Video Downloads
You can have custom scripts like below to download videos for offline view.
pip install youtube-dl
pkg install ffmpeg
In bin/termux-url-opener
have below script1, refer comments on how to use this script.
#!/data/data/com.termux/files/usr/bin/zsh
#
# This is a termux-url-opener script to do different tasks on my Android phone
#
#
#
# How to use this script
#############################
# Create the bin directory
# ➜ ~ mkdir bin
# ➜ ~ cd bin
# Create the script (copy & paste) I use neovim. Use your preferred editor
# ➜ nvim termux-url-opener
#
# Make it executable
# ➜ chmod +x termux-url-opener
#
# Install zsh wget and ffmpeg
# ➜ pkg install zsh wget ffmpeg python
# https://wiki.termux.com/wiki/Shells
#
# Install youtube_dl and scdl with pip
# ➜ pip install youtube_dl
# ➜ pip install scdl mutagen
#
# run the following command to enable the termux storage features
# ➜ termux-setup-storage
# https://wiki.termux.com/wiki/Termux-setup-storage
url=$1
echo "What should I do with $url ?"
echo "y) download youtube video to movies-folder."
echo "u) download youtube video and convert it to mp3 (music-folder)"
echo "s) download with scdl (soundcloud)."
echo "w) wget file to download-folder."
echo "x) nothing."
read CHOICE
case $CHOICE in
y)
youtube-dl -o "/storage/emulated/0/Movies/%(title)s.%(ext)s" $url
;;
u)
echo "Artist"
read artist
echo "Title"
read title
echo "Album"
read album
youtube-dl --extract-audio --audio-format mp3 --output "/storage/emulated/0/Music/$artist-$title.%(ext)s" $url
mid3v2 -a $artist -t $title -A $album /storage/emulated/0/Music/$artist-$title.mp3
;;
s)
scdl -l $url --path /storage/emulated/0/Music
echo "s need some work"
;;
w)
cd ~/storage/downloads
wget $url
;;
x)
echo "bye"
;;
esac
Neomutt
Neomutt is available in Termux. You can find the configurations on how to setup neomutt here
pkg install neomutt
pkg install feh
pkg install w3m
Conclusion
I hope this post helped you to get started with Termux. – RC
-
termux-url-opener · GitHub. https://gist.github.com/LordH3lmchen/dc35e8df3dc41d126683f18fe44ebe17 ↩
Comments