{
  "version": 1,
  "collections": [
    {
      "id": "9a227e99-e9dc-5f1c-913d-4433981eac23",
      "name": "ssh",
      "color": "#a78bfa"
    }
  ],
  "snippets": [
    {
      "id": "a4fa52b3-919e-5528-8eee-1ce8edb08d95",
      "collectionId": "9a227e99-e9dc-5f1c-913d-4433981eac23",
      "title": "Connect to a server",
      "body": "ssh {{user}}@{{host}}",
      "description": "",
      "tags": [
        "connect"
      ]
    },
    {
      "id": "777beab1-61d6-5a5c-9f47-aaa41bf049ac",
      "collectionId": "9a227e99-e9dc-5f1c-913d-4433981eac23",
      "title": "Connect on another port",
      "body": "ssh -p {{port:22}} {{user}}@{{host}}",
      "description": "",
      "tags": [
        "connect"
      ]
    },
    {
      "id": "f01932f0-8322-518b-b214-beba4a460db1",
      "collectionId": "9a227e99-e9dc-5f1c-913d-4433981eac23",
      "title": "Connect with a specific key",
      "body": "ssh -i {{key:~/.ssh/id_ed25519}} {{user}}@{{host}}",
      "description": "",
      "tags": [
        "connect"
      ]
    },
    {
      "id": "0537ab68-4992-59aa-b3c3-cad387c315ce",
      "collectionId": "9a227e99-e9dc-5f1c-913d-4433981eac23",
      "title": "Run one command remotely",
      "body": "ssh {{user}}@{{host}} '{{command}}'",
      "description": "",
      "tags": [
        "connect"
      ]
    },
    {
      "id": "4535bb27-fb1e-5127-ba5d-8c6e2b40c813",
      "collectionId": "9a227e99-e9dc-5f1c-913d-4433981eac23",
      "title": "Connect through a jump host",
      "body": "ssh -J {{jump_user}}@{{jump_host}} {{user}}@{{host}}",
      "description": "",
      "tags": [
        "connect"
      ]
    },
    {
      "id": "3eb024d9-77ee-5279-9b59-27a0515f05a9",
      "collectionId": "9a227e99-e9dc-5f1c-913d-4433981eac23",
      "title": "Test your GitHub key",
      "body": "ssh -T git@github.com",
      "description": "",
      "tags": [
        "connect"
      ]
    },
    {
      "id": "3c9d7518-a6cb-534c-bbc8-ce3a66906d53",
      "collectionId": "9a227e99-e9dc-5f1c-913d-4433981eac23",
      "title": "Close a frozen session",
      "body": "~.",
      "description": "Press Return first, then type ~ and a period.",
      "tags": [
        "connect"
      ]
    },
    {
      "id": "bf20db67-5b92-51de-bf45-1d9fb8de577b",
      "collectionId": "9a227e99-e9dc-5f1c-913d-4433981eac23",
      "title": "Generate a key",
      "body": "ssh-keygen -t ed25519 -C \"{{email}}\"",
      "description": "",
      "tags": [
        "keys"
      ]
    },
    {
      "id": "b254caf4-5035-56bf-a595-5711d393a619",
      "collectionId": "9a227e99-e9dc-5f1c-913d-4433981eac23",
      "title": "Install your key on a server",
      "body": "ssh-copy-id {{user}}@{{host}}",
      "description": "",
      "tags": [
        "keys"
      ]
    },
    {
      "id": "d339a3b5-49df-5ac6-97c6-e47bac8943a9",
      "collectionId": "9a227e99-e9dc-5f1c-913d-4433981eac23",
      "title": "Add a key to the agent and Keychain",
      "body": "ssh-add --apple-use-keychain {{key:~/.ssh/id_ed25519}}",
      "description": "macOS. On Linux: ssh-add <key>.",
      "tags": [
        "keys"
      ]
    },
    {
      "id": "d0806cf3-ff5b-50ef-84fa-601067f022a9",
      "collectionId": "9a227e99-e9dc-5f1c-913d-4433981eac23",
      "title": "List keys in the agent",
      "body": "ssh-add -l",
      "description": "",
      "tags": [
        "keys"
      ]
    },
    {
      "id": "e3a4b8e5-eb93-51fb-a70e-892199dc8055",
      "collectionId": "9a227e99-e9dc-5f1c-913d-4433981eac23",
      "title": "Copy your public key",
      "body": "pbcopy < {{key:~/.ssh/id_ed25519.pub}}",
      "description": "",
      "tags": [
        "keys"
      ]
    },
    {
      "id": "e80591c9-291f-5c2e-aa56-6234d9d1c254",
      "collectionId": "9a227e99-e9dc-5f1c-913d-4433981eac23",
      "title": "Show a key’s fingerprint",
      "body": "ssh-keygen -lf {{key:~/.ssh/id_ed25519.pub}}",
      "description": "",
      "tags": [
        "keys"
      ]
    },
    {
      "id": "5c5fca55-aa27-517a-8207-67c15cc64575",
      "collectionId": "9a227e99-e9dc-5f1c-913d-4433981eac23",
      "title": "Forget a server’s host key",
      "body": "ssh-keygen -R {{host}}",
      "description": "After a server is rebuilt and you get the “host identification has changed” warning.",
      "tags": [
        "keys"
      ]
    },
    {
      "id": "4ad70c9c-415e-5898-9c68-1a4911e8cc65",
      "collectionId": "9a227e99-e9dc-5f1c-913d-4433981eac23",
      "title": "Forward a remote port to your machine",
      "body": "ssh -N -L {{local_port:5432}}:{{target_host:localhost}}:{{target_port:5432}} {{user}}@{{host}}",
      "description": "Then connect to localhost:<local_port>. For example, a database only the server can reach.",
      "tags": [
        "tunnels"
      ]
    },
    {
      "id": "32015976-ef9a-5369-aca1-0bce95c5939b",
      "collectionId": "9a227e99-e9dc-5f1c-913d-4433981eac23",
      "title": "Share a local port with the server",
      "body": "ssh -N -R {{remote_port:8080}}:localhost:{{local_port:3000}} {{user}}@{{host}}",
      "description": "",
      "tags": [
        "tunnels"
      ]
    },
    {
      "id": "25ebb10f-1200-5e49-ae0b-d5adb10b90a9",
      "collectionId": "9a227e99-e9dc-5f1c-913d-4433981eac23",
      "title": "SOCKS proxy through a server",
      "body": "ssh -N -D {{port:1080}} {{user}}@{{host}}",
      "description": "",
      "tags": [
        "tunnels"
      ]
    },
    {
      "id": "79da50ee-dd36-545a-83d4-f834c1572165",
      "collectionId": "9a227e99-e9dc-5f1c-913d-4433981eac23",
      "title": "Copy a file to a server",
      "body": "scp {{file}} {{user}}@{{host}}:{{path:~}}",
      "description": "",
      "tags": [
        "files"
      ]
    },
    {
      "id": "13a0bd62-dae7-5389-a2b0-a5e23134e13b",
      "collectionId": "9a227e99-e9dc-5f1c-913d-4433981eac23",
      "title": "Copy a file from a server",
      "body": "scp {{user}}@{{host}}:{{path}} {{dest:.}}",
      "description": "",
      "tags": [
        "files"
      ]
    },
    {
      "id": "aa43e58f-3a46-5286-8924-9853d2eb5a41",
      "collectionId": "9a227e99-e9dc-5f1c-913d-4433981eac23",
      "title": "Copy a folder to a server",
      "body": "scp -r {{dir}} {{user}}@{{host}}:{{path:~}}",
      "description": "",
      "tags": [
        "files"
      ]
    },
    {
      "id": "3b0f667c-4aee-5acf-a942-595ecba9f355",
      "collectionId": "9a227e99-e9dc-5f1c-913d-4433981eac23",
      "title": "Sync a folder to a server",
      "body": "rsync -avz --progress {{source}} {{user}}@{{host}}:{{dest}}",
      "description": "A trailing slash on the source copies its contents rather than the folder itself.",
      "tags": [
        "files"
      ]
    },
    {
      "id": "2af99cd7-d021-5757-a396-1626581ecbdf",
      "collectionId": "9a227e99-e9dc-5f1c-913d-4433981eac23",
      "title": "Preview a sync that deletes extras",
      "body": "rsync -avzn --delete {{source}} {{user}}@{{host}}:{{dest}}",
      "description": "Shows what would change. Drop the n to do it.",
      "tags": [
        "files"
      ]
    },
    {
      "id": "1795792b-38f9-5b4c-98bf-86d9f7e5ecf8",
      "collectionId": "9a227e99-e9dc-5f1c-913d-4433981eac23",
      "title": "Host shortcut for ~/.ssh/config",
      "body": "Host {{alias}}\n  HostName {{host}}\n  User {{user}}\n  IdentityFile ~/.ssh/id_ed25519",
      "description": "Then just: ssh <alias>",
      "tags": [
        "config"
      ]
    },
    {
      "id": "671a2d48-b369-5784-b08f-97bd10d803a3",
      "collectionId": "9a227e99-e9dc-5f1c-913d-4433981eac23",
      "title": "Host behind a bastion",
      "body": "Host {{alias}}\n  HostName {{host}}\n  User {{user}}\n  ProxyJump {{jump_host}}",
      "description": "",
      "tags": [
        "config"
      ]
    },
    {
      "id": "12512b66-a305-5b63-a6ce-a60f412f0d17",
      "collectionId": "9a227e99-e9dc-5f1c-913d-4433981eac23",
      "title": "Keep idle connections open",
      "body": "Host *\n  ServerAliveInterval 60",
      "description": "",
      "tags": [
        "config"
      ]
    }
  ]
}
