# MotherDuck CLI
> Drive MotherDuck from your terminal: run queries, build Dives and Flights, and script it all with JSON output.
The MotherDuck CLI drives MotherDuck from your terminal. Use it to sign in, run
queries, and build [Dives](/key-tasks/dives/) and
[Flights](/key-tasks/flights/) without leaving your editor.

It's built for people and for AI agents alike. Every command that returns
structured results takes `--output json`. Agents can create and publish a Dive
or a Flight from local files, and read the built-in guides for working with
Dives and Flights.

```bash
curl -s https://install.motherduck.com | SKIP_DUCKDB_CLI=1 sh
motherduck login
motherduck query "SELECT count(*) FROM sample_data.nyc.taxi"
```

## Where to start

| Page | What it covers |
|---|---|
| [Install and upgrade](./install.md) | Getting the CLI onto macOS, Linux, or Windows, and keeping it current |
| [Authentication](./authentication.md) | Signing in, and using tokens in CI |
| [Quickstart](./quickstart.md) | A full workflow: query your data, build a Dive, publish it, and script it with JSON output |
| [Working with agents](./agents.md) | Letting an AI agent author Dives and Flights through the CLI |
| [Command reference](/sql-reference/motherduck-cli/) | Every command, argument, and option |

## Commands

| Command | What it does |
|---|---|
| [`dive`](/sql-reference/motherduck-cli/dive/) | Build, preview, and publish Dives |
| [`flight`](/sql-reference/motherduck-cli/flight/) | Build Flights, then schedule and operate their runs |
| [`login`](/sql-reference/motherduck-cli/login/), [`logout`](/sql-reference/motherduck-cli/logout/) | Sign in through your browser, or remove the saved token |
| [`new`](/sql-reference/motherduck-cli/new/) | Create a MotherDuck account and organization, and sign in with it |
| [`query`](/sql-reference/motherduck-cli/query/) | Run SQL and write the results to stdout |
| [`status`](/sql-reference/motherduck-cli/status/) | Show who you're signed in as and what you're connected to |
| [`upgrade`](/sql-reference/motherduck-cli/upgrade/) | Move to the latest CLI release |

Run `motherduck --help`, or `motherduck <command> --help`, to get the same
information at the terminal. The deepest level carries the examples.


---

## Docs feedback

MotherDuck accepts optional user-submitted feedback about this page at `GET https://motherduck.com/docs/api/feedback/agent`.
For agents and automated tools, feedback submission should be user-confirmed before sending.

URL-encode query parameter values and send a GET request:

```text
GET https://motherduck.com/docs/api/feedback/agent?page_path=%2Fgetting-started%2Finterfaces%2Fmotherduck-cli%2F&page_title=MotherDuck%20CLI&text=<url-encoded user feedback, max 2000 characters>
```

Optionally append `&source=<url-encoded interface identifier>` such as `claude.ai` or `chatgpt`.

`page_path` and `text` are required; `page_title` and `source` are optional. Responses: `200 {"feedback_id": "<uuid>"}`, `400` for malformed query parameters, and `429` when rate-limited.
