Snippets

Snippets are saved commands that you can:

The Team plan lets people with specific roles in a team share snippets with other team members. Sharing snippets is possible for team editors and admins.

Shared snippets appear among personal (not shared) snippets. Snippets can be filtered by type on the Snippets screen: all snippets, personal snippets ('my snippers'), and team's ('shared') snippets.

Snippets are a premium feature.

Add a Snippet

Desktop
Mobile
Desktop
  1. Navigate to the Snippets screen.

  2. Click + New at the top.

  3. In the Label field, specify an optional name for the snippet.

  4. In the Script field, add a command(s) that will be executed.

  5. (For team editors and admins) 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'.

  6. Click Save. The snippet will appear on the Snippets screen.

Creating a snippet in the desktop app
Mobile
  1. Navigate to the Snippets screen.

  2. Tap + at the top and choose New Shell Snippet.

  3. In the Name field, specify an optional name for the snippet.

  4. In the Script field, add a command(s) that will be executed.

  5. (For team editors and admins) 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'.

  6. Tap Save. The snippet will appear on the Snippets screen.

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

If it’s Bash that runs on a remote host, you can use && or ; to specify more than one command on a new line.

Run a Snippet

Desktop
Mobile
Desktop
  1. In the terminal, press Cmd + S (on Mac OS) or Ctrl + S (on Windows / Linux) to open the snippet picker panel.

  2. Choose one of the following:

    1. To run a snippet, click Run next to it.

    2. To insert a snippet, but not run, click Paste next to it.

You can resize the snippets panel by dragging its edge to the left.

Press Cmd + S / Ctrl + S to view or hide snippets
Mobile
  1. In the terminal, tap {} above the keyboard.

  2. If you don’t want run the snippet, but rather insert its contents into the terminal, uncheck Run snippet immediately.

  3. Tap a snippet you would like to execute.

Running a snippet using an iOS device

Run on Startup

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

Run on Multiple Hosts

Mobile
Mobile
  1. Navigate to the Snippets screen.

  2. Tap a snippet.

  3. Choose one of the following:

    1. To run the snippet on hosts that are not currently running:

      1. Select the hosts.

      2. If you’d like to disconnect from the host once the snippet is executed, uncheck Close sessions after running.

      3. Tap Run <snippet name>.

    2. To run the snippet on hosts that are currently running:

      1. Switch to the Terminals tab.

      2. Select the hosts (terminals).

      3. Tap Run <snippet name>.

Running a snippet on several hosts at once (iOS)

Share a snippet

Desktop
iOS
Android
Desktop

Right-click a snippet and choose Share with the team or create a shared snippet (see 'Add a snippet').

iOS

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

Android

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

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 require command line switches you may not 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.

To help get you started, we've created a few for you to use:

Find All Files Created or Modified Within 30 Days

find -type f -mtime -30

Find All Files Created or Modified Within 30 Days and Run a Command

find -type f -mtime -30 -exec

The -exec at the end allows you to specify a command. This snippet is intended to be run without pressing enter so that you can type the command to run on those matching files.

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

Search for a Running Process

ps aux | grep

This snippet is meant to be run without pressing enter. After using the snippet, type the name of the program you are searching for (i.e. "apache2"), and the process list will be searched for this name.