{
  "version": 1,
  "collections": [
    {
      "id": "11e2c8dc-5e9c-54b7-89b1-617239d1e1bb",
      "name": "terminal",
      "color": "#9ca3af"
    }
  ],
  "snippets": [
    {
      "id": "09028391-0f56-58ca-9347-24631764e503",
      "collectionId": "11e2c8dc-5e9c-54b7-89b1-617239d1e1bb",
      "title": "Find files by name",
      "body": "find {{dir:.}} -name \"{{pattern:*.log}}\"",
      "description": "",
      "tags": [
        "files"
      ]
    },
    {
      "id": "eb1e9c57-7cf7-5ae3-824e-c9553f68acc7",
      "collectionId": "11e2c8dc-5e9c-54b7-89b1-617239d1e1bb",
      "title": "Find big files",
      "body": "find {{dir:.}} -type f -size +{{size:100M}}",
      "description": "",
      "tags": [
        "files"
      ]
    },
    {
      "id": "feee6179-a3b6-5b89-aff8-b6c243b8242c",
      "collectionId": "11e2c8dc-5e9c-54b7-89b1-617239d1e1bb",
      "title": "Folder sizes, biggest last",
      "body": "du -sh {{dir:.}}/* | sort -h",
      "description": "",
      "tags": [
        "files"
      ]
    },
    {
      "id": "a680301b-0627-5052-84ac-de8e86a1e499",
      "collectionId": "11e2c8dc-5e9c-54b7-89b1-617239d1e1bb",
      "title": "Free disk space",
      "body": "df -h",
      "description": "",
      "tags": [
        "files"
      ]
    },
    {
      "id": "587c06e7-3458-5a88-b0a3-fe177a2d09bd",
      "collectionId": "11e2c8dc-5e9c-54b7-89b1-617239d1e1bb",
      "title": "Search for text in files",
      "body": "grep -rn \"{{text}}\" {{dir:.}}",
      "description": "",
      "tags": [
        "files"
      ]
    },
    {
      "id": "6102cac6-a789-5960-8a38-19016ebf1350",
      "collectionId": "11e2c8dc-5e9c-54b7-89b1-617239d1e1bb",
      "title": "Replace text in files",
      "body": "perl -pi -e 's/{{find}}/{{replace}}/g' {{files}}",
      "description": "Works the same on Mac and Linux, unlike sed -i.",
      "tags": [
        "files"
      ]
    },
    {
      "id": "815f0a56-e482-5f0c-bd54-2658acace174",
      "collectionId": "11e2c8dc-5e9c-54b7-89b1-617239d1e1bb",
      "title": "Follow a log file",
      "body": "tail -f {{file}}",
      "description": "",
      "tags": [
        "files"
      ]
    },
    {
      "id": "d36cd2a6-2bca-51fb-be40-6a9b32d0b7a9",
      "collectionId": "11e2c8dc-5e9c-54b7-89b1-617239d1e1bb",
      "title": "Compress a folder",
      "body": "tar -czf {{name}}.tar.gz {{dir}}",
      "description": "",
      "tags": [
        "files"
      ]
    },
    {
      "id": "445faa49-6b31-5e22-834b-90e617a23a76",
      "collectionId": "11e2c8dc-5e9c-54b7-89b1-617239d1e1bb",
      "title": "Extract a .tar.gz",
      "body": "tar -xzf {{file}}",
      "description": "",
      "tags": [
        "files"
      ]
    },
    {
      "id": "70994c6c-63b4-552c-bf9f-1e01426f5dfd",
      "collectionId": "11e2c8dc-5e9c-54b7-89b1-617239d1e1bb",
      "title": "Make a file executable",
      "body": "chmod +x {{file}}",
      "description": "",
      "tags": [
        "files"
      ]
    },
    {
      "id": "307ce661-9669-5c34-91a0-a3aa04fb34e2",
      "collectionId": "11e2c8dc-5e9c-54b7-89b1-617239d1e1bb",
      "title": "Create a symlink",
      "body": "ln -s {{target}} {{link}}",
      "description": "",
      "tags": [
        "files"
      ]
    },
    {
      "id": "ffde1071-cdd7-5f25-978a-a62ce6e2d4ac",
      "collectionId": "11e2c8dc-5e9c-54b7-89b1-617239d1e1bb",
      "title": "What’s using a port",
      "body": "lsof -i :{{port:3000}}",
      "description": "",
      "tags": [
        "processes"
      ]
    },
    {
      "id": "63b0dc4d-e434-5069-a608-d03914a92215",
      "collectionId": "11e2c8dc-5e9c-54b7-89b1-617239d1e1bb",
      "title": "Kill whatever is on a port",
      "body": "kill $(lsof -t -i :{{port:3000}})",
      "description": "",
      "tags": [
        "processes"
      ]
    },
    {
      "id": "871532b4-e68f-581d-9a52-4f5030694bbc",
      "collectionId": "11e2c8dc-5e9c-54b7-89b1-617239d1e1bb",
      "title": "Find a process",
      "body": "ps aux | grep -i {{name}}",
      "description": "",
      "tags": [
        "processes"
      ]
    },
    {
      "id": "2bdf4ff7-4ec1-5d57-8f0c-a9898fc46227",
      "collectionId": "11e2c8dc-5e9c-54b7-89b1-617239d1e1bb",
      "title": "Kill processes by name",
      "body": "pkill -f {{name}}",
      "description": "",
      "tags": [
        "processes"
      ]
    },
    {
      "id": "925930d2-5038-5725-9874-8a4d05930888",
      "collectionId": "11e2c8dc-5e9c-54b7-89b1-617239d1e1bb",
      "title": "Keep running after you log out",
      "body": "nohup {{command}} > {{log:output.log}} 2>&1 &",
      "description": "",
      "tags": [
        "processes"
      ]
    },
    {
      "id": "6eac29d7-cd52-5c6d-88e9-7dd0e5bc4f92",
      "collectionId": "11e2c8dc-5e9c-54b7-89b1-617239d1e1bb",
      "title": "Time a command",
      "body": "time {{command}}",
      "description": "",
      "tags": [
        "processes"
      ]
    },
    {
      "id": "e0fb3111-76c5-53ae-b1e7-2a786a4e1309",
      "collectionId": "11e2c8dc-5e9c-54b7-89b1-617239d1e1bb",
      "title": "Rerun a command every few seconds",
      "body": "watch -n {{seconds:2}} {{command}}",
      "description": "On a Mac: brew install watch.",
      "tags": [
        "processes"
      ]
    },
    {
      "id": "d9dd1906-dee2-5fc0-bef9-121db3fc6bc0",
      "collectionId": "11e2c8dc-5e9c-54b7-89b1-617239d1e1bb",
      "title": "Look up a domain’s IP",
      "body": "dig +short {{domain}}",
      "description": "",
      "tags": [
        "network"
      ]
    },
    {
      "id": "e6d28dc4-34ec-5ad1-aaff-97e85647ced0",
      "collectionId": "11e2c8dc-5e9c-54b7-89b1-617239d1e1bb",
      "title": "Check whether a port is open",
      "body": "nc -zv {{host}} {{port}}",
      "description": "",
      "tags": [
        "network"
      ]
    },
    {
      "id": "496cbf62-3f46-505a-a15c-e8d2ea9b2dec",
      "collectionId": "11e2c8dc-5e9c-54b7-89b1-617239d1e1bb",
      "title": "Your public IP address",
      "body": "curl -s https://ifconfig.me",
      "description": "",
      "tags": [
        "network"
      ]
    },
    {
      "id": "75f3e10b-519a-5fdf-a894-0d5869f6c405",
      "collectionId": "11e2c8dc-5e9c-54b7-89b1-617239d1e1bb",
      "title": "Most common lines",
      "body": "sort {{file}} | uniq -c | sort -rn | head -{{count:20}}",
      "description": "",
      "tags": [
        "text"
      ]
    },
    {
      "id": "dfb140a8-466f-5020-beef-627af81adcf2",
      "collectionId": "11e2c8dc-5e9c-54b7-89b1-617239d1e1bb",
      "title": "Print one column",
      "body": "awk '{print ${{column:1}}}' {{file}}",
      "description": "",
      "tags": [
        "text"
      ]
    },
    {
      "id": "1f3ba2aa-410d-5ec1-a473-12f2ba6fa82e",
      "collectionId": "11e2c8dc-5e9c-54b7-89b1-617239d1e1bb",
      "title": "Pretty-print JSON",
      "body": "jq . {{file}}",
      "description": "On a Mac: brew install jq.",
      "tags": [
        "text"
      ]
    },
    {
      "id": "c19c1d23-2c43-5303-9bc8-6d129ebc8552",
      "collectionId": "11e2c8dc-5e9c-54b7-89b1-617239d1e1bb",
      "title": "Base64-encode text",
      "body": "printf '%s' '{{text}}' | base64",
      "description": "",
      "tags": [
        "text"
      ]
    },
    {
      "id": "6e2615c6-c4be-56cc-8473-b53e667715d0",
      "collectionId": "11e2c8dc-5e9c-54b7-89b1-617239d1e1bb",
      "title": "Base64-decode text",
      "body": "printf '%s' '{{text}}' | base64 --decode",
      "description": "",
      "tags": [
        "text"
      ]
    },
    {
      "id": "a402e2d3-4382-552a-9ee1-ebab59b07f05",
      "collectionId": "11e2c8dc-5e9c-54b7-89b1-617239d1e1bb",
      "title": "Generate a random password",
      "body": "openssl rand -base64 {{bytes:24}}",
      "description": "",
      "tags": [
        "text"
      ]
    },
    {
      "id": "3c0131f5-e8eb-564d-95dd-0f299dd3cff4",
      "collectionId": "11e2c8dc-5e9c-54b7-89b1-617239d1e1bb",
      "title": "SHA-256 checksum of a file",
      "body": "shasum -a 256 {{file}}",
      "description": "",
      "tags": [
        "text"
      ]
    },
    {
      "id": "02f3eadd-afd0-5fde-b97f-27295a16313c",
      "collectionId": "11e2c8dc-5e9c-54b7-89b1-617239d1e1bb",
      "title": "Search your command history",
      "body": "Ctrl-R",
      "description": "Type part of an old command; press Ctrl-R again for older matches.",
      "tags": [
        "shell"
      ]
    },
    {
      "id": "f233c6b6-0b70-59bb-af9d-26a6ad077e2f",
      "collectionId": "11e2c8dc-5e9c-54b7-89b1-617239d1e1bb",
      "title": "Rerun the last command with sudo",
      "body": "sudo !!",
      "description": "",
      "tags": [
        "shell"
      ]
    },
    {
      "id": "c72dc17b-fdd5-53f9-a2b4-84d76d99f1aa",
      "collectionId": "11e2c8dc-5e9c-54b7-89b1-617239d1e1bb",
      "title": "Go back to the previous folder",
      "body": "cd -",
      "description": "",
      "tags": [
        "shell"
      ]
    },
    {
      "id": "eba6abf6-4d85-5e63-8a1a-86864b4f64bd",
      "collectionId": "11e2c8dc-5e9c-54b7-89b1-617239d1e1bb",
      "title": "Add a folder to PATH for this session",
      "body": "export PATH=\"{{dir}}:$PATH\"",
      "description": "",
      "tags": [
        "shell"
      ]
    },
    {
      "id": "56af849d-9053-5e36-ad96-bb3d9e1c232f",
      "collectionId": "11e2c8dc-5e9c-54b7-89b1-617239d1e1bb",
      "title": "Reload your shell config",
      "body": "source ~/.{{file:zshrc|bashrc}}",
      "description": "",
      "tags": [
        "shell"
      ]
    },
    {
      "id": "84fe8ce6-6c5e-5769-bf4a-c19a68391859",
      "collectionId": "11e2c8dc-5e9c-54b7-89b1-617239d1e1bb",
      "title": "Copy a command’s output to the clipboard",
      "body": "{{command}} | pbcopy",
      "description": "",
      "tags": [
        "macos"
      ]
    },
    {
      "id": "fc06ac74-ee2d-501c-a629-e5f1fc4f7000",
      "collectionId": "11e2c8dc-5e9c-54b7-89b1-617239d1e1bb",
      "title": "Open a folder in Finder",
      "body": "open {{dir:.}}",
      "description": "",
      "tags": [
        "macos"
      ]
    },
    {
      "id": "790e1413-c2c4-5ff5-8044-415b9244065b",
      "collectionId": "11e2c8dc-5e9c-54b7-89b1-617239d1e1bb",
      "title": "Flush the DNS cache",
      "body": "sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder",
      "description": "",
      "tags": [
        "macos"
      ]
    },
    {
      "id": "9661fe72-6d89-5e8a-bacf-46ccf2106462",
      "collectionId": "11e2c8dc-5e9c-54b7-89b1-617239d1e1bb",
      "title": "Keep the Mac awake",
      "body": "caffeinate -d",
      "description": "Until you press Ctrl-C.",
      "tags": [
        "macos"
      ]
    }
  ]
}
