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 Cloudflare Tunnels (formerly Argo Tunnels) associated with your Cloudflare account that have been created using `cloudflared`. It provides an overview of each tunnel, including its UUID, name, creation time, and current status.

    Syntax

    bash
    cloudflared tunnel list [flags]

    Explanation

    This command queries the Cloudflare API to retrieve information about your tunnels. It's particularly useful for quickly checking which tunnels exist, their unique identifiers, and whether they are currently running (connected) or not. The output typically includes the following columns:

    * **ID**: The unique identifier (UUID) of the tunnel.

    * **NAME**: The user-assigned name of the tunnel.

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

    * **CONNECTIONS**: The number of `cloudflared` instances currently connected to this tunnel. If it's 0, the tunnel is not active.

    * **ORIGIN IP**: The IP address of the `cloudflared` instance connecting to the tunnel. This may vary if multiple instances are connecting or if using dynamic IPs.

    * **ARCH**: The architecture of the `cloudflared` instance.

    * **VERSION**: The version of `cloudflared` connecting.

    Usage Examples

    #### 1. List all active and inactive tunnels

    This is the most common use case, providing a complete overview of all your tunnels.

    bash
    cloudflared tunnel list

    **Example Output:**

    ID                                   NAME                 CREATED                       CONNECTIONS  ORIGIN IP     ARCH     VERSION
    4e1a0b3e-f1b2-4c3d-a4e5-6f7a8b9c0d1e my-web-app           2023-10-27T10:30:00Z          1            192.0.2.10    linux/amd64 2023.10.0
    f9c8d7e6-a5b4-c3d2-e1f0-1g2h3i4j5k6l staging-api          2023-11-01T15:00:00Z          0            -             -         -
    1a2b3c4d-5e6f-7g8h-9i0j-1k2l3m4n5o6p dev-proxy            2023-11-05T08:00:00Z          2            192.0.2.11    linux/amd64 2023.10.0

    In this example:

    * `my-web-app` and `dev-proxy` tunnels are active with 1 and 2 connections respectively.

    * `staging-api` tunnel is inactive (`CONNECTIONS: 0`).

    #### 2. Filtering for specific columns (not directly supported by `list` command, but can be achieved with `grep` or `jq`)

    While `cloudflared tunnel list` doesn't have built-in flags for column filtering, you can pipe its output to other command-line tools like `grep` or `jq` (if you convert the output to JSON, which `cloudflared` itself doesn't directly support for `list` by default) for more advanced filtering. However, for basic human-readable output, the default `list` is usually sufficient.

    For example, to see only tunnels with active connections:

    bash
    cloudflared tunnel list | grep -v 'CONNECTIONS  ORIGIN IP' | awk '{if ($4 > 0) print $0}'

    This example is a bit more complex, first excluding the header, then checking the 'CONNECTIONS' column (the 4th field) to be greater than 0.

    #### 3. Listing with specific account (if configured with multiple accounts)

    If your `cloudflared` configuration allows for multiple Cloudflare accounts, you might need to specify which account to operate on using the `--config` flag or by ensuring your `~/.cloudflared/cert.pem` and `~/.cloudflared/config.yml` are correctly set for the desired account. The `tunnel list` command will then operate within the context of that authenticated account.