A snippet is a saved command that you can:

Note: On the desktop and Android, snippets are available only through a subscription.

Create a snippet

  1. Choose Snippets in the main menu.
  2. Click + New snippet at the top.
  3. (Optionally) in the Add a package menu, select a package in which you want to place the snippet.
  4. (Optionally) in the Label field, provide a name for the snippet.
  5. In the Script field, enter a command(s) that should be executed.
  6. If you are a team owner or editor, choose one of the following:
    1. To create a shared snippet, choose Team snippets next to 'Create in'.
    2. To create a personal snippet, choose My snippets next to 'Create in'.
  7. Click ➔ at the top right to hide the snippet's details.
    ezgif-4-6b77affb84.gif
  1. Choose Snippets in the main menu.
  2. Tap + and then New shell snippet.
  3. (Optionally) in the Package field, select a package in which you want to place the snippet.
  4. (Optionally) in the Name field, provide an optional name for the snippet.
  5. In the Script field, enter a command(s) that should be executed.
  6. If you are a team owner or editor, choose one of the following:
    1. To create a shared snippet, choose Team next to 'Create in'.
    2. To create a personal snippet, choose Personal next to 'Create in'.
  7. In the Optional defaults section, you can specify settings that will be auto-selected when you run the snippet from the Snippets screen on iOS / Android.
  8. Tap Save / ✔️.
  9. ezgif-1-80800cf6e8.gif

Note: Don't use \n in a snippet as it will not have an effect. It will be treated as two separate characters, not an escape sequence. For specifying several commands in a snippet, add each one of them on a new line.

Note: In the case of Bash, you can use  &&  or ; to specify more than one command on a new line.

Edit / remove a snippet

  1. Choose Snippets in the main menu.
  2. Find the snippet you want to edit or remove.
  3. Right-click the snippet and choose Edit / Remove.
    ezgif-4-a93d71bb60.gif
  1. Choose Snippets in the main menu.
  2. Find the snippet you want to edit or remove.
  3. Tap and hold the snippet, then tap Edit or Delete.
  4. ezgif-1-719fafd230.gif
  1. Choose Snippets in the main menu.
  2. Find the snippet you want to edit or remove.
  3. Tap and hold the name of the snippet, then tap  Vector.png  or  Shape.png
  4. 16545363814606746926196093906665.gif

Run a snippet

  1. When in the terminal, press Cmd + S (on macOS) or Ctrl + S (on Windows, Linux).
  2. Choose one of the following:
    1. To insert a snippet, but not run, click Paste next to it.
      ezgif-5-7fc4de3e01.gif
    2. To run a snippet, double-click it or click Run.
      ezgif-5-8a972ed7bf.gif
  1. In the terminal, tap {} above the keyboard.
  2. If you don't want to run the snippet, but rather insert its contents into the terminal, uncheck Run snippet immediately.
  3. Tap a snippet you would like to execute.
  4. ezgif-1-ddac4baefc.gif

Run on several hosts at once

In the desktop app, a snippet can be executed in all active sessions.

One of the ways to do so is from the Snippets screen:

  1. Choose Snippets screen in the main menu.
  2. Right-click the snippet you want to run and click Run in all tabs.
    ezgif-4-ff7850bffb.gif

Another way is using the snippet picker panel:

  1. When in the terminal, press Cmd + S (on macOS) or Ctrl + S (on Windows, Linux).
  2. Right-click the snippet you want to run and click Run in all tabs.
    Screenshot_2022-06-08_at_17.35.18.png
  1. Choose Snippets in the main menu.
  2. Tap the snippet you want to execute.
  3. Choose one of the following:
    1. To run the snippet on hosts that you are currently connected to:
      1. Switch to the Terminals tab.
      2. Select the hosts (terminals).
      3. Tap Run <snippet name>.
    2. To run the snippet on hosts you are currently not connected to:
      1. Select the hosts.
      2. If you want to stay connected to the hosts after the snippet is executed, uncheck Close sessions after running.
      3. Tap Run <snippet name>.
      4. runs.gif

Run upon connection

To make a snippet automatically run when you connect to a host, specify the snippet as Startup Snippet in the properties of the host entry.

ezgif-3-a7c931d891.gif

Note: This option is available only through a subscription.

Organize snippets into packages

A snippet package is a named container for your snippets. You can create one and populate it with snippets on the Snippets screen. The snippet packages you create are displayed at the top of the Snippets screen.

Add a snippet package

  1. Choose Snippets in the main menu.
  2. Click + New package at the top.
  3. Provide a name for the snippet package and click Save.ezgif-5-51ef91de6b.gif
  1. Choose Snippets in the main menu.
  2. Tap + and then New package.
    IMG_2F2E36F8D253-1.jpeg
  3. Provide a name for the snippet package and tap Save / ✔️.

Add snippets to a snippet package

To add a single snippet to a snippet package, specify the snippet package in the snippet's properties.

To add several snippets in bulk, use drag and drop.

ezgif-5-30d617c64f.gif

To add a single snippet to a snippet package, specify the snippet package in the snippet's properties.

ezgif-5-588f46f737.gif

To add several snippets in bulk, use the Select option.

ezgif-5-287214d79b.gif

To add a single snippet to a snippet package, specify the snippet package in the snippet's properties.

1654620710711449786845822137700.gif

To add several snippets in bulk, use drag and drop.

16546935008196486562876267374862.gif

Note: To remove a snippet from a package, click Remove or tap  ✕  in the snippet's properties.

Share a snippet

The Team plan lets the owner and editors share snippets with the rest of the team, including the Member role.

Snippets can be filtered by type on the Snippets screen: all snippets, personal snippets, and team snippets.

Right-click a snippet and choose Share or create a shared snippet (see 'Create a snippet').

Screenshot_2022-06-07_at_19.04.56.png

Tap and hold the snippet and tap Share or create a shared snippet (see 'Create a snippet').

IMG_444621DBE1D1-1.jpeg

Tap and hold the name of the snippet, tap the top-right icon and then Share.

Alternatively, you can create a shared snippet (see 'Create a snippet').

Screenshot_20220606_234819_com.server.auditor.ssh.client.jpg

Example snippets

Snippets are powerful. There are many commands that you may run on a day-to-day basis that are either cumbersome to type (especially on a mobile device) or that are hard to remember. Instead of constantly searching or referencing a sheet for these things, snippets allow you to store this knowledge and save time in your daily server tasks.

Below are a few example snippets.

Find all files created or modified within 30 days

find -type f -mtime -30

Obtain disk usage and free space statistics

du -ch

List listening ports and owning processes

netstat -tolpn

Display kernel log

sudo dmesg

List all running processes

ps auxw

A snippet with a variable

echo Enter the process name: && read process_name && ps aux | grep $process_name

This snippet prompts you to provide a pattern that it then uses for finding all active processes. The snippet can be used in Bash and other shells that provide an alternative to the read command.

Was this article helpful?

14 out of 40 found this helpful

Add comment

Please sign in to leave a comment.