Aller au contenu

Save and run snippets

Ce contenu n’est pas encore disponible dans votre langue.

A snippet is a saved command or script you can type into any session. Snippets sync with your hosts. On the desktop they are under Snippets in the sidebar; on the phone under Settings › Tools › Snippets.

  1. Choose New snippet.
  2. Give it a Name, and write the Script: the text typed into the session, one or more lines.
  3. Choose its Kind:
    • Command: typed into the session and, when you run it, followed by Enter.
    • Note: only ever pasted at the prompt, without Enter, so you can check it first.
    • Macro: a list of steps that types, waits for output and answers prompts (below).
  4. Optionally put it in a Package, a folder for snippets that belong together.
  5. Save.

With an AI provider set up (Settings › AI), Describe what it should do writes the script for you from a sentence. Read it before you save or run it.

Write {{name}} where a value should be asked for, or {{name:default}} to offer a default:

Terminal window
sudo systemctl restart {{service:nginx}}

These are filled in, never asked: {{$HOST}} (the host’s address), {{$USER}} (the user name it logs in as), {{$PORT}} and {{$NAME}} (the host’s label). A local terminal has no host, so give such a built-in a default there: {{$USER:root}}.

A value you type is inserted exactly as typed, with no quoting: quote it in the script if it may hold spaces. Built-ins are quoted for the host’s shell where Sternway has seen a POSIX shell or fish on that host, and refused where they cannot be placed safely. The field help has the full rules.

  • In a terminal: press Ctrl+. (macOS: Cmd+.) or Ctrl+Shift+P to open the snippets beside the terminal, and choose one. Or search for it with the command palette, Ctrl+K. Asked-for values are filled in the side panel.
  • With a key of its own (desktop): give the snippet a Keyboard shortcut. It works while a terminal has the focus, and is kept on this device only.
  • In all tabs: run a command snippet in every open terminal at once.
  • On several hosts: Run on hosts… on the snippet. See Act on many hosts at once, including Collect results, which shows each host’s exit status and output.
  • When a host connects: set it as the host’s Startup snippet in the host editor.

A macro’s Steps are one per line:

send sudo -i
wait for "password for"
send secret identity "Ops admin"
wait for /[#$] $/ 10s
send systemctl restart nginx
  • send types the rest of the line and Enter (variables and built-ins are filled in).
  • wait for "text" or wait for /pattern/ waits for the output, 30 seconds unless you write another time.
  • send secret identity "Name" types that identity’s saved password; key "Name" a key’s passphrase; host "Name" a host’s saved password.
  • pause 2s waits; a line starting with # is a comment.

A secret is typed only into a terminal it belongs to (a host’s password into a session to that host or through it), only right after a wait whose line is still the terminal’s last line and is a password prompt ending in :, and never into a local terminal. It is not written to the window, the scrollback, recordings, logs, AI or a shared session. If another password prompt comes right after it (a wrong password), or none at all, the macro stops and types nothing more. Locking the app stops every macro.

A snippet in a team vault is there for everyone in that vault. Copy or Move it to another vault from its menu. A macro only reaches secrets saved in its own vault, so a macro shared with a team cannot type your personal passwords.

© 2026 IRONPINE LABS LLC
ALL RIGHTS RESERVED.