Snippets
Snippets are saved SSH commands that you can run on any connection with a single tap. Instead of typing the same df -h or docker logs command every time you connect, save it as a snippet and execute it instantly from the snippet drawer or the terminal toolbar.
Built-in Snippet Library
Section titled “Built-in Snippet Library”ZestSSH ships with a curated library of over 40 default snippets organized into seven categories:
System — Everyday server health commands: top -bn1 | head -20 (system stats), df -h (disk usage), free -h (memory), uptime, w (who’s online), lscpu | head -15, process listing sorted by memory, kernel version, and sudo reboot (with confirmation prompt).
Services — Systemd management: list running services, check status, restart, stop, view recent logs (journalctl), follow logs live, and enable services at boot. These snippets use dynamic variables (explained below) to let you pick the target service from a live list pulled from the server.
Docker — Container operations: list running or all containers, view or follow logs, restart, stop, open an interactive shell (docker exec -it), view stats, check disk usage, and prune unused resources (with confirmation).
Network — Connectivity diagnostics: public IP lookup, listening ports (ss -tlnp), DNS lookup (dig), ping, traceroute, connection summary, firewall rules, and ARP table.
Files — Disk and file utilities: find large files over 100 MB, directory sizes sorted by size, tail a log file live or grab the last 50 lines, find a file by name, check permissions, and list block devices.
Security — Audit commands: failed logins (lastb), recent logins (last), open ports via nmap, auth log tail, active SSH sessions, and sudo group membership.
Packages — System updates for Debian/Ubuntu (apt update && apt upgrade) and RHEL/Fedora (dnf update), installed package count, and available updates. Update commands require confirmation before running.
Custom Snippets
Section titled “Custom Snippets”Tap the + button on the Snippets screen to create your own. Each snippet has:
- Label — a short display name (e.g., “Deploy Staging”).
- Command — the shell command to execute.
- Category — an optional grouping tag. You can use existing categories or create new ones.
- Confirm Before Run — when enabled, ZestSSH shows a confirmation dialog before executing. Use this for destructive commands.
Custom snippets are stored in the local Drift (SQLite) database alongside the defaults. You can edit or delete custom snippets at any time; default snippets can be deleted too, but they will reappear if you reset to defaults.
Variable Placeholders
Section titled “Variable Placeholders”Snippets support three types of variable placeholders that prompt the user for input before execution:
Free-text Variables: ${VAR}
Section titled “Free-text Variables: ${VAR}”Place ${VAR} anywhere in a command to prompt the user for free-form text input. The variable name becomes the input label. Examples:
ping -c 4 ${HOST}tail -f ${LOGFILE}find / -name '${FILENAME}' 2>/dev/nullWhen you run the snippet, ZestSSH shows a text field for each unique variable. If the same ${VAR} appears multiple times, the user enters the value once and it replaces all occurrences.
Inline-list Variables: $[opt1,opt2,opt3]
Section titled “Inline-list Variables: $[opt1,opt2,opt3]”Use $[option1,option2,option3] to present a dropdown of predefined choices:
git checkout $[main,develop,staging]systemctl $[start,stop,restart,status] nginxDynamic-list Variables: $[DOCKER]
Section titled “Dynamic-list Variables: $[DOCKER]”Use $[KEYWORD] with a recognized keyword to have ZestSSH query the remote server and populate the dropdown live. Supported dynamic sources:
| Keyword | Populates From | Display Name |
|---|---|---|
DOCKER | docker ps --format '{{.Names}}' | Docker Containers |
PM2 | pm2 jlist (parsed JSON) | PM2 Processes |
SYSTEMD | systemctl list-units (running) | Systemd Services |
SCREEN | screen -ls | Screen Sessions |
TMUX | tmux list-sessions | Tmux Sessions |
Example: docker logs $[DOCKER] --tail 50 runs docker ps on the connected server, presents the container names in a dropdown, and substitutes your choice into the command.
Legacy Syntax
Section titled “Legacy Syntax”The older ${[opt1,opt2]} syntax (list inside curly braces) is still supported for backward compatibility, but $[...] is preferred for new snippets.
Destructive Command Confirmation
Section titled “Destructive Command Confirmation”Any snippet with Confirm Before Run enabled shows an orange confirmation dialog before executing. This prevents accidental runs of commands like sudo reboot, docker system prune -f, or apt upgrade. Several built-in snippets have this flag set by default.
When a snippet is triggered through automation (Tasker, Shortcuts, deep links), the confirmation flag is bypassed since the intent was explicitly sent by the automation system with an API key.
Using Snippets
Section titled “Using Snippets”There are several ways to run a snippet:
- Snippets screen — open from the home screen or bottom navigation. Tap any snippet to execute it on the active session.
- Terminal toolbar — the snippet button in the terminal toolbar opens a quick-pick drawer.
- Automation — trigger snippets remotely via
zestssh://snippetdeep links, Tasker intents, or iOS Shortcuts. See the Automation docs. - Workflows — include a snippet as a step in a multi-step workflow. The workflow engine resolves the snippet by name and can pass variable values.
Snippet References on Connections
Section titled “Snippet References on Connections”Each saved connection can optionally reference a default snippet. When you connect, that snippet appears as a quick-action suggestion. If a snippet is deleted, ZestSSH automatically clears all connection references to it.