DEV Community

Stephano Kambeta
Stephano Kambeta

Posted on

5 Termux Scripts Every Freelancer Should Have

Freelancing means wearing many hats. You are the developer, the accountant, the sysadmin, and the customer support rep. Termux on Android lets you carry a tiny, powerful Linux toolbox in your pocket. With the right scripts, you can automate chores, avoid mistakes, and protect your work time. Below I share five practical Termux scripts every freelancer should have, how to use them, and safe, ethical ways to fit them into a real workflow.

Why scripts matter

Scripts remove repetitive tasks, reduce human error, and free you to focus on billable work. A 30 second manual task done 10 times a day adds up. Scripts also help you standardize how you invoice, backup, deploy, and secure files. If you already follow guides like Quick Termux projects you can do or basics like How to install Termux, these scripts are the natural next step.

1) Project bootstrap script: start a new gig in 30 seconds

When a new client says yes, you need a consistent project structure, a README, a .gitignore, and a virtual environment. This script creates a folder, initializes git, adds a README template, and opens the folder in your editor. It saves you decision fatigue and gives clients a professional first impression.

#!/bin/bash
# newproject.sh
if [-z "$1"]; then
  echo "Usage: ./newproject.sh project-name"
  exit 1
fi
mkdir -p "$1"
cd "$1"
git init
cat>&README.md<
Enter fullscreen mode Exit fullscreen mode

How to use: save as newproject.sh, chmod +x newproject.sh, then ./newproject.sh client-site. This ties well with posts on running services from Termux like Turn your Android into a web server.

2) Quick backup to remote storage

Clients expect you to keep copies. This script zips a project and uploads it to a remote server or cloud storage. Use SSH keys and a secure host. If you use a VPN while uploading, see recommendations in VPNs to use when using Termux and the Surfshark review.

#!/bin/bash
# backup.sh
PROJECT="$1"
DEST="user@backup.example.com:/backups"
if [-z "$PROJECT"]; then
  echo "Usage: ./backup.sh project-folder"
  exit 1
fi
tar -czf "${PROJECT}-$(date +%Y%m%d).tar.gz" "$PROJECT"
scp "${PROJECT}-"*.tar.gz "$DEST"
echo "Backup complete"

Enter fullscreen mode Exit fullscreen mode

Notes: replace the destination with your backup host. If you prefer cloud, use rclone or an S3 client. Backups are part of professional practices you may already read about in posts like Cyber security for small companies.

3) Time tracker and simple invoice generator

Tracking hours and producing quick invoices keeps cashflow healthy. This simple script logs session start and stop times, sums hours per project, and generates a plain text invoice you can email. Keep invoices clear and minimal. Use this as the basis, then adapt to your rate and currency format.

#!/bin/bash
# timelog.sh
LOG="$HOME/timelog.csv"
case "$1" in
  start)
    echo "$(date +%Y-%m-%d),$2,START,$(date +%H:%M:%S)" >> "$LOG"
    echo "Started $2"
    ;;
  stop)
    echo "$(date +%Y-%m-%d),$2,STOP,$(date +%H:%M:%S)" >> "$LOG"
    echo "Stopped $2"
    ;;
  invoice)
    awk -F, -v project="$2" '$2==project {print}' "$LOG" > /tmp/invoice-$2.txt
    echo "Invoice for $2" > /tmp/invoice-$2.out
    echo "----------------" >> /tmp/invoice-$2.out
    cat /tmp/invoice-$2.txt >> /tmp/invoice-$2.out
    echo "Invoice written to /tmp/invoice-$2.out"
    ;;
  *)
    echo "Usage: timelog.sh start|stop|invoice project-name"
    ;;
esac

Enter fullscreen mode Exit fullscreen mode

Tip: pair this with your project bootstrap script. For a more polished approach, export the invoice as PDF using a command line tool and attach it to your client email.

4) Secure file transfer: send deliverables safely

When sending deliverables, prefer encrypted transfer. Use scp over SSH or an encrypted archive. This script packages a folder into an encrypted zip and uploads to the recipient host. Keep private keys safe and check host fingerprints before first connect. If you need guidance on incident response and selecting a secure vendor, see Best cyber incident response companies and building a plan in Cyber security plan for small business.

#!/bin/bash
# sendsecure.sh
if ["$#" -ne 3]; then
  echo "Usage: sendsecure.sh folder recipient@host destpath"
  exit 1
fi
FOLDER="$1"
RECIP="$2"
DEST="$3"
zip -r "${FOLDER}.zip" "$FOLDER"
openssl enc -aes-256-cbc -salt -in "${FOLDER}.zip" -out "${FOLDER}.zip.enc"
scp "${FOLDER}.zip.enc" "$RECIP:$DEST"
rm "${FOLDER}.zip" "${FOLDER}.zip.enc"
echo "Sent encrypted archive to $RECIP"

Enter fullscreen mode Exit fullscreen mode

Remember: share the decryption passphrase via a separate channel, like a phone call or a temporary secure message. For general network hygiene and secure connections, read Network security tips for small business.

5) Health check: daily environment and dependency update

Nothing worse than a deadline hit by broken dependencies. This script checks that your key services are reachable, your git repo is up to date, and your package lists are current. It can run at login or via a cron-like loop using Termux:Boot or Termux Tasker integration.

#!/bin/bash
# healthcheck.sh
echo "Checking network..."
ping -c 1 8.8.8.8 >/dev/null && echo "Network OK" || echo "Network down"
echo "Checking git status..."
if [-d .git]; then
  git fetch
  status=$(git status --porcelain)
  if [-z "$status"]; then
    echo "Repo clean"
  else
    echo "Uncommitted changes"
  fi
fi
echo "Updating packages..."
pkg update -y && pkg upgrade -y
echo "Health check complete"

Enter fullscreen mode Exit fullscreen mode

Automate with Termux:Boot or a scheduled task. Keeping your environment current aligns with best practices covered in articles like Things to do after installing Termux.

Security and ethics reminders

Termux is powerful. Use it responsibly. Scripts that automate network or security scanning belong in authorized, ethical contexts only. If your work touches sensitive systems, follow policies and get permission. For ethical guidelines and protecting client data, read Can hackers control self driving cars for a sobering look at security risks, and consult defensive resources like What is cyber threat intelligence and NIST CSF.

Putting it together

Here is a simple workflow you can adopt today:

  • Use the project bootstrap script when a client signs a contract.
  • Start a session with the time tracker script to log billable hours.
  • Run the health check daily or before major work blocks.
  • Backup your work nightly with the backup script and keep the backup off-device.
  • Send final deliverables with the secure transfer script and share passwords separately.

These five scripts are a foundation. From here you can build more: automated deploys, simple CI using git hooks, notification scripts, or integration with cloud services. If you want project ideas to practice these scripts, check Quick Termux projects you can do.

Further reading and useful references

Final notes

Make these scripts yours. Keep them simple, document them in the README created by the bootstrap script, and store them in a private dotfiles repo. Automating routine tasks does not replace discipline. It multiplies it. If you want, I can adapt any of the scripts above to your exact workflow, add logging, or make a packaged dotfiles repo you can clone into Termux. Tell me the services and tools you rely on and I will build the next iteration.

Top comments (0)