> ## Documentation Index
> Fetch the complete documentation index at: https://docs.upstackdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# upstack history

> Inspect or re-run previously executed queries. Every query run is logged locally.

Every query run is logged locally to `~/.upstack_history.json`. The CLI doesn't send history anywhere — it's purely a convenience for you. History keeps the last 50 entries; `upstack history` lists the most recent 20.

## Usage

```bash theme={null}
upstack history                # last 20 entries
upstack history --show <id>    # inspect a single entry
upstack history --rerun <id>   # re-run a previous query
upstack history --clear        # delete all entries
```

## Flags

| Flag                | Description                                                                                                                                        |
| ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--show <id>`       | Print the command, timestamp, and full parameters for one history entry. Doesn't print the original result — use `--rerun` to fetch fresh results. |
| `--rerun <id>`      | Re-run a previous query with the same parameters. Useful for "what did yesterday look like, exactly?"                                              |
| `--output <format>` | Output format for `--rerun`: `json`, `table`, or `csv`.                                                                                            |
| `--file <path>`     | Write `--rerun` output to a file instead of stdout.                                                                                                |
| `--clear`           | Delete all history entries. No confirmation.                                                                                                       |
