# CLI

### 🧠 What is `thinr-cli`?

`thinr-cli` is the **command-line interface for ThinRemote**, a secure tunneling and device management platform. It enables **zero-config remote access** to embedded devices, industrial gateways, or IoT fleets from your terminal—no VPNs, no port-forwarding, and no complex firewall rules.

Think of `thinr-cli` as your terminal-based control center to:

* **Securely access remote shells (SSH/console)**
* **Proxy TCP or HTTP(S) services running on remote devices**
* **Monitor and retrieve device status, metrics, and properties**
* **Trigger remote procedures (e.g., restart services, apply config)**
* **Manage devices in groups via product-based batch operations**

### 🔧 Common Use Cases

| 🧩 Use Case                                    | Command Example                                                  |
| ---------------------------------------------- | ---------------------------------------------------------------- |
| Remote shell (like SSH)                        | `thinr device dev123 console`                                    |
| Proxy a local web service                      | `thinr device dev123 http 8080`                                  |
| Proxy a remote web service in the same network | `thinr device dev123 http http://192.168.1.45:8080`              |
| Access a service port                          | `thinr device dev123 tcp --remote-port 1883`                     |
| Check device health                            | `thinr device dev123 status --json`                              |
| Fetch device properties                        | `thinr device dev123 property information --field 'hardware.id'` |
| Reboot a device                                | `thinr device dev123 resource reboot`                            |
| Reboot all devices belonging to a group        | `thinr product devproduct resource reboot`                       |

### 🚀 Quick Start

#### 1. Installation

Use npm to install the CLI globally:

```
npm install -g @thinremote/thinr-cli
```

#### 2. Launch & Authenticate

Start the CLI:

```
thinr
```

You'll be guided through authentication using:

* **Username/password**, or
* **Access token**
* **OAuth flow**

### 📚 Additional Information & Resources

Whether you're getting started or scaling your remote fleet, here are some helpful links and community touchpoints:

#### 🔗 Official Resources

* **GitHub Repository (thinr-cli)**\
  <https://github.com/Thin-Remote/thinr-cli>\
  The most up-to-date command reference, issue tracking, and release history.
* **CLI Package on npm**\
  <https://www.npmjs.com/package/@thinremote/thinr-cli>

***

#### 💬 Community & Support

* **Submit Bugs or Feature Requests**\
  Use the [GitHub issues page](https://github.com/Thin-Remote/thinr-cli/issues) to report problems or suggest improvements.

***

#### 🧭 Best Practices

* Use `--json` + `--field` for scripting and automation.
* Use `products` to group devices logically (e.g. by customer, region, device type).
* Proxy web apps like Node-RED, Grafana, or custom dashboards with `--web`.
* Never open ports — use HTTPS tunnels to stay secure and compliant.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.thinremote.io/product-guides/cli.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
