Skip to content

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.

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.

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.

Snippets support three types of variable placeholders that prompt the user for input before execution:

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/null

When 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.

Use $[option1,option2,option3] to present a dropdown of predefined choices:

git checkout $[main,develop,staging]
systemctl $[start,stop,restart,status] nginx

Use $[KEYWORD] with a recognized keyword to have ZestSSH query the remote server and populate the dropdown live. Supported dynamic sources:

KeywordPopulates FromDisplay Name
DOCKERdocker ps --format '{{.Names}}'Docker Containers
PM2pm2 jlist (parsed JSON)PM2 Processes
SYSTEMDsystemctl list-units (running)Systemd Services
SCREENscreen -lsScreen Sessions
TMUXtmux list-sessionsTmux 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.

The older ${[opt1,opt2]} syntax (list inside curly braces) is still supported for backward compatibility, but $[...] is preferred for new snippets.

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.

There are several ways to run a snippet:

  1. Snippets screen — open from the home screen or bottom navigation. Tap any snippet to execute it on the active session.
  2. Terminal toolbar — the snippet button in the terminal toolbar opens a quick-pick drawer.
  3. Automation — trigger snippets remotely via zestssh://snippet deep links, Tasker intents, or iOS Shortcuts. See the Automation docs.
  4. 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.

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.