The fastest way to level up your productivity is to stop doing things manually that a computer can do for you. Every repeated task is an automation opportunity. Every multi-step process is a script waiting to be written.
This article covers practical scripting and automation techniques I use daily: from backup scripts to shell aliases to scheduled tasks. None of this is theoretical. These are real tools solving real problems.
Scripting
Scripts turn multi-step procedures into single commands. They eliminate human error, save time, and create documentation of how things work as a side effect.
Generally, this is done in the command line interface.
Backup Remotely Over rsync
rsync is the gold standard for remote backups. It only transfers what’s changed, it can resume interrupted transfers, and it works over SSH.
A basic remote backup:
rsync -avz --delete -e ssh /home/you/important-data/ you@backup-server:/backups/important-data/
Breaking this down:
-
-a— Archive mode: preserves permissions, timestamps, symlinks, and directory structure -
-v— Verbose: shows what’s being transferred -
-z— Compress: reduces bandwidth usage during transfer -
--delete— Removes files from the destination that no longer exist at the source (true mirror) -
-e ssh— Use SSH as the transport
Wrap it in a script with logging:
#!/bin/bash
# backup-remote.sh — Mirror local data to a remote backup server
LOG="/var/log/backup-$(date +%Y%m%d).log"
SOURCE="/home/you/important-data/"
DEST="you@backup-server:/backups/important-data/"
echo "=== Backup started: $(date) ===" >> "$LOG"
rsync -avz --delete -e ssh "$SOURCE" "$DEST" >> "$LOG" 2>&1
echo "=== Backup finished: $(date) ===" >> "$LOG"
This gives you a timestamped log of every backup run, which is invaluable when you need to verify that backups are actually happening.
Automation
Automation means making things happen without you having to remember to do them. The tools below cover the three major operating systems.
AutoHotKey (Windows)
AutoHotKey is a Windows automation tool that lets you remap keys, create macros, and automate repetitive GUI tasks. It’s particularly useful for tasks that don’t have a CLI equivalent.
Common use cases:
-
Text expansion: Type a short abbreviation and have it expand to a full block of text — your email signature, a common code snippet, a frequently used command.
-
Window management: Bind hotkeys to resize, move, or arrange windows exactly how you want them.
-
Application launching: One keystroke to open your most-used applications.
-
Repetitive clicking: Automate form-filling or GUI workflows that would otherwise eat your afternoon.
Example — text expansion:
; Type "addr" followed by a space to expand to your business address
::addr::123 Main Street, Suite 100, Seattle, WA 98101
Example — launch applications with a hotkey:
; Win+T opens terminal
#t::Run, wt.exe
If you’re on Windows and not using AutoHotKey, you’re leaving hours on the table every week.
Zsh Aliases
Shell aliases are the lowest-effort, highest-reward automation you can set up. Add them to your ~/.zshrc (or ~/.bashrc):
# Navigation shortcuts
alias ..="cd .."
alias ...="cd ../.."
alias ll="ls -lahF"
# Git shortcuts
alias gs="git status"
alias gl="git log --oneline -20"
alias gp="git pull"
# SSH shortcuts
alias jump-dev="ssh -D 12345 you@dev-jump.example.com"
alias jump-staging="ssh -D 12346 you@staging-jump.example.com"
# Common operations
alias myip="curl -s ifconfig.me"
alias ports="ss -tlnp"
alias diskuse="df -h | grep -v tmpfs"
# Safety nets
alias rm="rm -i"
alias mv="mv -i"
alias cp="cp -i"
After editing, reload with source ~/.zshrc.
The real power comes from building aliases that encode your specific workflows. If you type the same command more than three times a day, alias it.
AppleScript (macOS)
AppleScript lets you automate macOS applications. It’s especially useful for tasks involving the GUI that can’t be done from the terminal.
Example — open a specific set of applications for your work session:
tell application "Terminal" to activate
tell application "Firefox" to activate
tell application "Visual Studio Code"
activate
open "/Users/you/Projects/current-project"
end tell
Example — send a message in a chat application:
tell application "Messages"
set targetService to 1st service whose service type = iMessage
set targetBuddy to buddy "team@example.com" of targetService
send "Deployment complete." to targetBuddy
end tell
You can run AppleScripts from the terminal with osascript, which means you can call them from shell scripts and cron jobs.
Practical Examples
Check the Date of Your Latest Backup
A backup that isn’t being verified is a backup that might not exist. This script checks when your most recent backup ran:
#!/bin/bash
# check-backup.sh — Report the age of the latest backup
BACKUP_DIR="/backups/important-data"
if [ -d "$BACKUP_DIR" ]; then
LAST_MODIFIED=$(stat -c %Y "$BACKUP_DIR" 2>/dev/null || stat -f %m "$BACKUP_DIR")
CURRENT=$(date +%s)
AGE_HOURS=$(( (CURRENT - LAST_MODIFIED) / 3600 ))
if [ "$AGE_HOURS" -gt 48 ]; then
echo "WARNING: Last backup is ${AGE_HOURS} hours old!"
else
echo "OK: Last backup is ${AGE_HOURS} hours old."
fi
else
echo "ERROR: Backup directory does not exist!"
fi
Run this daily. Better yet, schedule it.
Cron: Schedule a Backup
Cron is the standard UNIX task scheduler. Edit your crontab with crontab -e:
# Run backup every night at 2:00 AM
0 2 * * * /home/you/bin/backup-remote.sh
# Check backup age every morning at 8:00 AM
0 8 * * * /home/you/bin/check-backup.sh | mail -s "Backup Status" you@example.com
Cron schedule format:
┌───────────── minute (0 - 59) │ ┌───────────── hour (0 - 23) │ │ ┌───────────── day of month (1 - 31) │ │ │ ┌───────────── month (1 - 12) │ │ │ │ ┌───────────── day of week (0 - 7, where 0 and 7 are Sunday) │ │ │ │ │ * * * * * command
Tips:
-
Always use full paths in cron jobs — cron runs with a minimal environment.
-
Redirect output to a log file or pipe to
mailso you know if something fails. -
Use
crontab -lto list your scheduled jobs.
At: Run a Command at a Specific Time
While cron handles recurring tasks, at handles one-time scheduled tasks. It’s perfect for “remind me later” or “send this after the meeting.”
Schedule an email to send at a specific time:
echo 'echo "The deployment window opens now." | mail -s "Deployment Reminder" you@example.com' | at 10:00 PM
echo 'echo "Monthly report is due tomorrow." | mail -s "Report Reminder" you@example.com' | at 9:00 AM tomorrow
Other at time formats:
at now + 2 hours
at 4:00 PM Friday
at noon tomorrow
at midnight
List pending jobs with atq and remove one with atrm <job-number>.
The Compounding Effect
Each individual script or alias saves minutes. But they compound. A two-minute task you automate and run daily saves you over 12 hours a year. Ten of those and you’ve reclaimed three full work weeks.
The tools to make this happen are free, built into your operating system, and waiting for you to use them. Start with aliases. Graduate to scripts. Schedule them with cron. Before long, your computer is doing the tedious work while you focus on the work that actually requires your brain.
