Termux Cheatsheet

Termux Cheatsheet

Termuxwas very first program I installed after buying my first Android phone, it is the best Terminal emulator on Android with it’s own repository which contains programs like ssh, php, nodejs, perl, etc. Here is a list of common commands and programs I keep inTermux

Update packages and package index

  • Type:pkg uporapt update && apt upgrade

Enable tab completion

  • Type:pkg i bash-completionand restart

Enable spell correction for bash

It works for cd command, Add this line to.bashrc

shopt -s cdspell

Change prompt

Add this line to.bashrc

PS1="\[\033[1;30m\][\@] \[\033[1;37m\]Ravindra@Termux:\w $ \[\033[0;37m\]"

Disable start up banner

touch ~/.hushlogin

Add welcome banner

  • Installation:pkg i figlet pv
  • Add following line to .bashrc
figlet "Welcome Ravindra" | pv -qL 500

Install Aria

aria2is a command based download manager, it is faster than curl, wget. It has resume support, it can download torrent files and etc.

  • Installation:pkg i aria2
  • Downloading:aria2 <url>

Install Megatools

megatoolsallows us to download files form mega.nz, I like command version because it fast and very small in size but it doesn’t have resume support.

  • Installation:pkg i megatools
  • Download:megadl <url>

Install Oh My ZSH

  • Install curl, zsh and git:pkg i curl git zsh
  • Now Follow official guideNOTE: We can’t set zsh as default, you can add a line in .bashrc to automatically start zsh but it is not a good idea for small devices

Install WFuzz

  • Install dependencies:pkg i python python-dev openssl openssl-dev curl clang libcrypt libcrypt-dev libcurl libcurl-dev
  • Select SSL Library:export PYCURL_SSL_LIBRARY=openssl
  • Installation:pip install wfuzz

Install TOR & TORSOCKS

  • Installation:pkg i torsocks
  • Typevim $PREFIX/etc/tor/torrcto open tor config file.
  • Add a new lineSocks5Proxy 127.0.0.1:9050
  • Start Tor:tor
  • Stop Tor: Just CTRL + C, if you’ve usedtor&thenpkill tor
  • Torify shell:source torsocks onand everything will route through tor.
  • Stop torifing shell:source torsocks offand everything will fallback to normal behaviour.
  • Using NMap: Always use TCP scannmap -sT blah blah blahand don’t run nmap as root.

Check all open ports on your phone (Root required)

  • Installtsu:pkg i tsu
  • Typetsu
  • Typenetstat -puntland it will list all open ports and programs using them.
  • If you see something unfamilliar then you may be a victom of open port vulnerability.

SSH

  • Installation:pkg i openssh
  • SSH client is ready, you can keep keys in $HOME/.ssh
  • Server only supports SSH Key so go to$HOME/.ssh
    • Generate a new SSH Key pair:ssh-keygen
    • Add content of public key to~/.ssh/authorized_keys
    • Typesshdto start SSH server on port 8022
    • Connect from another system.

PHP

PHP has MySQL support by default and postgres support can be added using packages, postgres and mysql database are available.

  • Installation:pkg i php

Install common programs

  • 7z:pkg i p7zip
  • C/C++ Compiler:pkg i clangGCC is not available anymore.
  • FFMpeg:pkg i ffmpeg
  • Git:pkg i git
  • Hydra:pkg i hydra
  • Nano:pkg i nano
  • Nmap:pkg i nmap
  • Node:pkg i nodejs
  • SQLMap:pkg i python2 && pip2 install -U sqlmap
  • Vim:pkg i vim
  • Youtube-DL:pkg i ffmpeg python && pip install -U youtube_dl

Original: Updated: