Using Conn
Snippets and the palette
The command palette holds your snippets, over 50 built-in presets and everything you've run before. Snippets take variables, and can run across a whole group of hosts.
The command palette
Open Run a Command from a terminal:
- iPhoneiPad the ⌘ button in the bar (in the ⋯ menu when the bar has no room), or the ⌘ key on the key bar's fn page;
- MaciPad ⇧⌘P, or the ⌘ button at the top.
It has two sections: History (this host's commands first, most used first, then other hosts') and Presets and snippets. Search presets and history matches a name, a command or a category. New Snippet (the plus) and the History menu are at the top, or on a Mac in the row at the bottom beside Done.
What happens when you choose one
- A command is typed at the prompt with Return. In a shell that reads pasted text safely, it waits at the prompt for your Return.
- A snippet with a variable opens a sheet first: What it needs, then What will be sent to the host, with Run.
- A preset that changes something, and any imported snippet, asks Run this on the host first.
- A group snippet opens Run on a Group.
Built-in presets
Conn comes with 59 presets in nine categories: systemd, Logs, Disk, Network, Processes, Packages, git, Files and tmux. Those that change something always ask first.
When a terminal opens, Conn asks the host which tools it has, and hides presets for tools it lacks. A line at the foot of the palette says so: Show All Presets shows them anyway, and Only host's Tools hides them again.
Built-in presets can't be changed. Touch and hold (or right click) one for View Preset, Duplicate (to make your own copy you can edit) and Run on a Group...
Making a snippet
Choose New Snippet in the palette to write one. Save as Preset, on a command in History, saves it at once, named after the command, in the category "From history"; change it later with Edit Snippet... A snippet has:
| Field | What it's for |
|---|---|
| Name | How you find it in the palette, such as "Pull the latest code". |
| Command | What it runs, such as git -C {{folder}} pull. It can be several lines. |
| Variables | A starting value for each variable, if you want one. |
| Where It Runs | In the terminal: typed into the session you run it from. On a group: run on each host in a group. |
| Ask Before Running | Always asks before it sends anything. |
| Category | Shown under its name in the palette, and found by search, such as "Git". |
| Needs the Tool | A tool it needs, such as git, so it's hidden on hosts without it. |
| Notes | What it does, in one line. |
Your own snippets have Edit Snippet..., Duplicate, Delete Snippet and Run on a Group... With iCloud sync on, snippets sync to your other devices, and deleting one deletes it there too.
Variables
Write {{name}} where a value goes, and Conn asks for it before anything is sent. The field is labelled with the name, with underscores shown as spaces. Spaces inside the braces are fine.
Four values come from the host itself:
| Write | Gets |
|---|---|
{{host.name}} | The host's name in Conn |
{{host.address}} | Its address |
{{host.user}} | The user name you sign in with |
{{host.port}} | Its SSH port |
- Conn won't run while a value is empty or has a line break in it.
- A value that starts with a dash gets a warning, because the host will read it as an option, but you can still run it.
- Templates such as
{{.Field}}, which start with a dot, are left alone, so commands that use their own templates keep working.
Run on a Group
Run a snippet on every host in a group at once: from a snippet's menu, from Save and Run on a Group, or from Run on a Group... on a group's heading in Hosts.
- Choose the Snippet and the Group. Values shared by every host are asked once.
- What each host will be sent shows the exact command for each host, or why it won't run there.
- Set the Time Limit per Host: 10 seconds, 30 seconds (the default), 60 seconds or 300 seconds. That's the longest Conn waits for each host to connect, sign in and finish.
- Conn always asks first, naming how many hosts it will run on.
Each host runs the command on its own (over SSH exec, not in a terminal). The results come back as one row per host, with how long it took, the first five lines of output, and one of:
| Result | Means |
|---|---|
| Exit status 0 | It finished without an error (shown in green). |
| Exit status n | It finished and reported an error. |
| Killed by signal name | Something stopped it on the host, such as TERM. |
| No answer in time | The host didn't finish within the time limit. |
| Stopped, may have run | You pressed Stop after it was sent. |
| Did not run | It wasn't sent to that host. |
| Unknown whether it finished | The connection went before the host said. |
| Its key is not trusted yet | Conn hasn't met this machine's SSH key. Open a terminal on it once. |
| Its identity has changed | The machine's SSH key changed. Open a terminal on it to see both keys and decide. |
| Its identity could not be checked | Conn couldn't check the machine's key, so it didn't run there. |
A group run never trusts a new machine. A host whose SSH key Conn hasn't seen yet, or whose key has changed, is skipped. Open a terminal on it once first.
Command history
The palette remembers the commands you run, so you can run them again.
- Conn records only lines the host echoed back, so passwords you type at a prompt aren't kept.
- It doesn't keep a line that starts with a space, empty lines, lines over 2,000 characters, or lines with control characters.
- History stays on this device: it never syncs, isn't in exported files, and Conn asks for it to be left out of backups.
- Turn off Remember Commands Run Here, in Edit Host, Terminal, for a host whose commands you don't want kept. Conn asks, then deletes what it has for that host.
- Clear it from the palette's History menu (one host, or all), or from Settings. On iPhone and iPad, swipe a command right to save it as a preset, or left to delete it.
From the Shortcuts app
The Run Snippet action opens a terminal on a host with a snippet's command shown. Nothing runs until you choose Run. See Shortcuts and links.
Something missing, wrong or unclear? Tell us and we'll fix it.