DEV Community

Stephano Kambeta
Stephano Kambeta

Posted on

10 Useful Widgets You Can Build with Termux-Widget

If you want one-tap superpowers on Android, Termux-Widget is your friend. In this guide, I will show you ten practical widgets you can create to save time, automate routine DevOps and security tasks, and make your phone feel like a mini workstation. Everything here is beginner friendly, ethical, and built to solve real problems without rooting your device.

What you need

  1. Install Termux from F-Droid, then set up the basics. If you are brand new, start with my Termux install guide and the checklist in things to do after installing Termux.
  2. Install the companion apps from F-Droid:
    • Termux:API for notifications, toasts, device info
    • Termux:Widget for home screen buttons
  3. Give storage access:
termux-setup-storage
Enter fullscreen mode Exit fullscreen mode
  1. Create the shortcuts folder:
mkdir -p ~/.shortcuts
chmod -R 700 ~/.shortcuts
Enter fullscreen mode Exit fullscreen mode

Each widget below is a small shell script you will save in ~/.shortcuts/. Make the file executable. After saving, add the Termux-Widget to your home screen, then tap the three dots on the widget to pick your script.


Widget 1: One-Tap Update and Health Check

Use it when your packages feel outdated, storage is tight, or you need a quick sanity check before you start work.

#!/data/data/com.termux/files/usr/bin/sh
set -e
pkg update -y && pkg upgrade -y
echo "Top disk consumers:" > /sdcard/termux_health.txt
du -sh ~/.* 2>/dev/null | sort -hr | head -n 10 >> /sdcard/termux_health.txt
echo "" >> /sdcard/termux_health.txt
echo "IP and latency:" >> /sdcard/termux_health.txt
timeout 3 ping -c 1 1.1.1.1 | sed -n '2p' >> /sdcard/termux_health.txt
termux-notification --title "Termux updated" --content "Health report saved to /sdcard/termux_health.txt"
termux-toast "Update complete"
Enter fullscreen mode Exit fullscreen mode

Why it helps quick maintenance without opening the terminal.

Related reading keep your stack healthy with my quick Termux projects.

Widget 2: Start a Local Web Server

Use it when you want to preview a static site or share a folder over LAN.

#!/data/data/com.termux/files/usr/bin/sh
cd ~/storage/shared || exit 1
python -m http.server 8000 >/dev/null 2>&1 &
echo $! > ~/.httpserver.pid
termux-notification --title "HTTP server" --content "Serving /sdcard on :8000"
Enter fullscreen mode Exit fullscreen mode

Stop button save this as a second widget:

#!/data/data/com.termux/files/usr/bin/sh
[-f ~/.httpserver.pid] && kill "$(cat ~/.httpserver.pid)" && rm ~/.httpserver.pid
termux-toast "HTTP server stopped"
Enter fullscreen mode Exit fullscreen mode

Related reading want a real web stack, not just Python http.server, see Nginx on Termux.

Widget 3: Instant Secure Tunnel With Ngrok

Use it when you need to share a local service for a quick client review or webhook test.

#!/data/data/com.termux/files/usr/bin/sh
PORT="${1:-8000}"
~/.local/bin/ngrok http "$PORT" >/dev/null 2>&1 &
sleep 2
curl -s http://127.0.0.1:4040/api/tunnels | jq -r '.tunnels[0].public_url' | tee /sdcard/ngrok_url.txt
termux-notification --title "Ngrok" --content "$(cat /sdcard/ngrok_url.txt)"
Enter fullscreen mode Exit fullscreen mode

Related reading full setup here install and use ngrok in Termux. If you expose things to the internet, review network security tips to reduce risk.

Widget 4: Quick Network Scan With Nmap

Use it when you move between WiFi networks and want to map live hosts. Use responsibly on networks you own or have permission to test.

#!/data/data/com.termux/files/usr/bin/sh
SUBNET="$(ip route | awk '/src/ {print $1; exit}')"
termux-toast "Scanning $SUBNET"
nmap -sn "$SUBNET" -oN /sdcard/nmap_ping_sweep.txt
termux-notification --title "Nmap scan complete" --content "Results saved to /sdcard/nmap_ping_sweep.txt"
Enter fullscreen mode Exit fullscreen mode

Related reading learn the flags in my Nmap in Termux guide. If you are new to packet sniffing concepts, start with packet sniffing 101.

Widget 5: Public IP, Geo, and WHOIS Snapshot

Use it when you troubleshoot VPNs or need to record where a server appears on the internet for a ticket.

#!/data/data/com.termux/files/usr/bin/sh
IP="$(curl -s https://ifconfig.me)"
WHOIS="$(whois "$IP" | sed -n '1,40p')"
GEO="$(curl -s https://ipinfo.io/$IP)"
{
echo "IP: $IP"
echo ""
echo "$GEO"
echo ""
echo "$WHOIS"
} > /sdcard/ip_snapshot.txt
termux-notification --title "IP snapshot" --content "Saved to /sdcard/ip_snapshot.txt"
Enter fullscreen mode Exit fullscreen mode

Related reading strengthen privacy with a VPN that actually works on Termux workflows. Compare options in VPNs to use with Termux and my hands-on Surfshark review.

Widget 6: One-Tap Notes Inbox

Use it when you want a frictionless capture for commands, ideas, or client timestamps.

#!/data/data/com.termux/files/usr/bin/sh
MSG="$(termux-dialog -t 'Quick Note' -i 'Type and press OK' | jq -r .text)"
[-n "$MSG"] && echo "$(date +%F_%T) $MSG" >> ~/notes/inbox.txt
termux-notification --title "Saved" --content "Added to ~/notes/inbox.txt"
Enter fullscreen mode Exit fullscreen mode

Tip sync ~/notes with Git or a cloud tool. If this becomes part of your business process, align it with your cyber security plan so you control access.

Widget 7: Incident Snapshot Pack

Use it when a device behaves oddly. Grab fast evidence to share with your security partner.

#!/data/data/com.termux/files/usr/bin/sh
OUT="/sdcard/incident_$(date +%F_%H%M%S)"
mkdir -p "$OUT"
logcat -d > "$OUT/logcat.txt" 2>/dev/null
ip addr > "$OUT/ip_addr.txt"
ss -tulpen > "$OUT/listening_ports.txt" 2>/dev/null || netstat -tulpen > "$OUT/listening_ports.txt" 2>/dev/null
ps -A > "$OUT/processes.txt"
tar -czf "$OUT.tar.gz" -C "$(dirname "$OUT")" "$(basename "$OUT")"
termux-notification --title "Incident bundle ready" --content "$OUT.tar.gz"
Enter fullscreen mode Exit fullscreen mode

Related reading know who to call. See best incident response companies and keep your playbook aligned with NIST CSF.

Widget 8: Port Listener and Quick File Drop With Netcat

Use it when you want to receive a file from a laptop on the same network without pairing.

#!/data/data/com.termux/files/usr/bin/sh
PORT="${1:-9000}"
DEST="/sdcard/drop_$(date +%s).bin"
nc -l -p "$PORT" > "$DEST"
termux-notification --title "Netcat" --content "Saved incoming data to $DEST"
Enter fullscreen mode Exit fullscreen mode

Related reading learn more tricks in Netcat in Termux. For safe sharing to outsiders, prefer a tunnel plus access controls as covered in NISTIR 8286 and business risk.

Widget 9: WiFi Monitor Toast

Use it when you change networks often and want a visible status.

#!/data/data/com.termux/files/usr/bin/sh
SSID="$(termux-wifi-connectioninfo | jq -r .ssid)"
IP="$(ip -o -4 addr show wlan0 | awk '{print $4}' | cut -d/ -f1)"
termux-toast "WiFi:$SSID IP:$IP"
Enter fullscreen mode Exit fullscreen mode

Related reading if you run guest networks or decoys for research, read my simple guide to WiFi Honey. If your interest is learning attacks and defenses, start from awareness topics like phishing and avoid offensive misuse.

Widget 10: Safe Link Opener For Security Awareness

Use it when you train a team. Provide one-tap access to internal policies, awareness pages, or checklists.

#!/data/data/com.termux/files/usr/bin/sh
termux-open-url "https://terminaltools.blogspot.com/2025/08/cyber-security-plan-for-small-business.html"
Enter fullscreen mode Exit fullscreen mode

Swap the URL with a resource you want the team to read. For example, reduce real-world social engineering risk by reviewing social engineering basics. If you research phishing kits for defense, do it responsibly and start with awareness posts like MaxPhisher in Termux and Zphisher that focus on detection and prevention.


Hardening tips for your Termux-Widget setup

  • Name carefully widgets appear as file names. Use clear names like 01_update.sh, 02_web_start.sh so they sort logically.
  • Keep scope minimal a widget should do one thing well. If a script grows, move it to ~/bin and keep the widget as a thin wrapper.
  • Use notifications every script above confirms success. Add set -e to stop on errors and notify the outcome.
  • VPN first on untrusted networks review safe choices in VPNs to use with Termux and my Surfshark review.
  • Know your boundaries only scan or test what you own or are authorized to test. If you are exploring big topics like connected cars, start with my explainer can hackers control self driving cars which focuses on safety and awareness.

Troubleshooting

Widget not showing ensure the script is in ~/.shortcuts/ and has execute permission:

chmod +x ~/.shortcuts/*.sh
Enter fullscreen mode Exit fullscreen mode

Commands not found make sure packages are installed:

pkg install termux-api python nmap tar ncurses-utils curl jq net-tools
Enter fullscreen mode Exit fullscreen mode

Server not reachable from another device phone and client must be on the same network, and the phone must be awake. For external sharing, use the ngrok widget and review exposure risks in network security tips.

Where to go next

Ethical reminder

Tools like Nmap and tunnels are powerful. Use them for learning, defense, and automation within legal and ethical boundaries. If your small business handles customer data, align your scripts to your security baseline and keep an escalation path to a trusted responder. If things go sideways, do not panic, capture evidence with the incident widget, then contact a professional using this list.


Copy checklist

  • Create ~/.shortcuts/
  • Save the scripts you need from above
  • chmod +x them
  • Add the Termux-Widget to the home screen
  • Tap and go

If you want me to turn these into a ready-to-clone repo with a simple installer, tell me which widgets you want included. I will keep the scripts small, readable, and aligned with your security plan.

Top comments (0)