CLI Companion

  • Hugging Face CLI
    • login
    • whoami
    • repo create
    • upload
    • download
    • lfs-enable-largefiles
    • scan-cache
    • delete-cache
  • Hapi CLI
    • new
    • start
    • build
    • test
    • plugin create
    • route add
  • Cloudflared
    • tunnel
    • tunnel run
    • tunnel list
    • tunnel delete
    • access
    • access tcp
    • update

    The `cloudflared tunnel list` command is used to display a list of all tunnels associated with your Cloudflare account that are managed by the current `cloudflared` instance's credentials. This command is essential for quickly seeing which tunnels are configured, their IDs, names, status, and which account they belong to.

    Syntax

    bash
    cloudflared tunnel list [OPTIONS]

    Options

    While `cloudflared tunnel list` is relatively straightforward, some general `cloudflared` options might indirectly affect its behavior (e.g., `--config` to specify a different configuration file).

    * `--json`: Output the list in JSON format. This is useful for scripting and programmatic access.

    * `--region string`: Specify the Cloudflare region to query for tunnels. (e.g., "auto", "us-central1")

    Usage Examples

    #### 1. List all tunnels

    This is the most common use case, simply showing all tunnels managed by your credentials.

    bash
    cloudflared tunnel list

    **Example Output:**

    ID                                   NAME                  CREATED              REMOTE CONNECTORS      TUNNEL TYPE   LOCALLY RUNNING     ARCHIVED   CONNECTIONS
    12345678-abcd-abcd-abcd-1234567890ab my-web-app-tunnel     2023-01-01 10:00 UTC 2                      CFD           2                   false      us-west.0
    us-west.1
    98765432-efgh-efgh-efgh-9876543210ef my-api-tunnel         2023-03-15 14:30 UTC 1                      CFD           1                   false      us-east.0
    abcdef01-1234-5678-90ab-cdef01234567 staging-tunnel        2023-05-20 08:00 UTC 0                      CFD           0                   false

    **Explanation:**

    * **ID**: The unique identifier of the tunnel.

    * **NAME**: The user-defined name for the tunnel.

    * **CREATED**: The timestamp when the tunnel was created.

    * **REMOTE CONNECTORS**: The number of `cloudflared` instances actively connected to the Cloudflare network for this tunnel (running remotely).

    * **TUNNEL TYPE**: The type of tunnel (e.g., CFD for `cloudflared` tunnels).

    * **LOCALLY RUNNING**: The number of `cloudflared` instances *on the local machine* that are currently running this specific tunnel. This helps differentiate between tunnels configured locally but not running, and those actively managed.

    * **ARCHIVED**: Indicates if the tunnel has been archived (true/false). Archived tunnels are not active but their configuration is retained.

    * **CONNECTIONS**: A list of active connections to Cloudflare's edge, including the data center location.

    #### 2. List tunnels in JSON format

    For scripting or automated processing, using the `--json` flag is highly recommended.

    bash
    cloudflared tunnel list --json

    **Example Output (truncated for brevity):**

    json
    [
      {
        "id": "12345678-abcd-abcd-abcd-1234567890ab",
        "name": "my-web-app-tunnel",
        "created_at": "2023-01-01T10:00:00Z",
        "deleted_at": null,
        "is_deleted": false,
        "is_archived": false,
        "connections": [
          {
            "id": "01234567-89ab-cdef-0123-456789abcdef",
            "features": [
              "http",
              "snihint"
            ],
            "version": "2023.10.0",
            "client_id": "some-client-id",
            "client_ip": "192.0.2.1",
            "opened_at": "2023-01-01T10:00:05Z",
            "origin_ip": "198.51.100.1",
            "private_ip": "10.0.0.10",
            "cloudflared_id": "a-cloudflared-instance-id",
            "cloudflared_version": "2023.10.0",
            "cloudflared_os": "linux",
            "cloudflared_arch": "amd64",
            "remote_address": "some-edge-address:7844",
            "edge_location": "us-west",
            "region": "us-west",
            "region_version": "1"
          }
        ],
        "tunnel_type": "CFD"
      }
    ]

    **Explanation:**

    When using `--json`, the output is an array of tunnel objects, providing a much more detailed and machine-readable representation of each tunnel and its associated connections. This includes detailed information about each active connector, its version, OS, IP addresses, and the Cloudflare edge location it's connected to.

    Important Considerations

    * **Authentication**: The `cloudflared tunnel list` command relies on the credentials configured for your `cloudflared` instance, typically found in `~/.cloudflared/cert.pem`. Ensure you are authenticated to the correct Cloudflare account to see all relevant tunnels.

    * **Local vs. Remote**: The `LOCALLY RUNNING` column helps you see if a tunnel listed is *also* being run by the `cloudflared` instance you're currently interacting with, which is useful for debugging.

    * **Archived Tunnels**: By default, `cloudflared tunnel list` will show both active and archived tunnels. To filter, you'd typically need to process the output (e.g., using `grep` or `jq` with `--json`).