---
title: Browse a luna's data
description: Find lunas, read and change their rows, manage their files, and look at indexes and sandboxes from the luna CLI.
related:
  - /data/query-across-lunas
  - /files-and-code/store-files
  - /files-and-code/run-a-sandbox
---

Each luna keeps its own tables and files, so a database client cannot reach them. When a bug report names one customer, you need to see that customer's luna as it is.

The `luna data`, `luna files`, `luna indexes` and `luna sandboxes` commands read a luna's contents from your terminal. They act on the environment the folder uses, and `--env` picks another.

## Find a luna

[`luna data lunas`](/cli/data) lists the keys of a luna type's lunas, 100 at a time unless you pass `--limit`.

```bash
luna data lunas List
```

Pass `--search` to keep the keys that hold some text in any field, ignoring case. For a key of several fields, `a / b` looks for `a` in the first field and `b` in the second.

```bash
luna data lunas Card --search "b1 / c"
```

## Name a luna in the other commands

The other commands take the luna type, then the key. For a key of one field, write that field's value alone.

```bash
luna data rows List groceries items
```

For a key of several fields, write the key as JSON.

```bash
luna data rows Card '{"board":"b1","card":"c1"}' notes
```

## Read a table's rows

`luna data rows` prints a page of a table's rows, 50 unless you pass `--limit`. Each row starts with its `rowid`, which the commands that change a row take.

When more rows follow, the command prints the `--after` value that reads the next page.

```bash
luna data rows List groceries items --after <ROWID>
```

Pass `--json` to get the rows as JSON instead of a table. Columns that Luna keeps for itself are not shown.

## Change, add and delete rows

`luna data set` changes one value of one row. Numbers, `true`, `false` and JSON are read as the column's type takes them, and `--null` empties the value.

```bash
luna data set List groceries items <ROWID> done true
```

`luna data add` adds a row from `column=value` pairs, and the columns you leave out take their defaults. It prints the new row's `rowid`.

```bash
luna data add List groceries items text=milk done=false
```

`luna data delete` removes one row. It asks first, and `--yes` answers in advance.

```bash
luna data delete List groceries items <ROWID>
```

These changes land like a write from a handler, so live queries see them. No handler of the luna runs for them. A change the table refuses, such as one that breaks a constraint, changes nothing.

:::warning
Editing a production luna skips the checks in your handlers, and a deleted row cannot be undeleted. Fork the luna first with `luna fork`, or note the time, so `luna restore` can rewind a mistake.
:::

Columns of bytes or vectors cannot be set from the CLI. Set those from your code. An index's rows change only through the tables it reads from.

## Work with a luna's files

[`luna files`](/cli/files) reaches the files in the buckets a luna type's code defines. `luna files list` shows a folder, its subfolders first.

```bash
luna files list List groceries attachments items/
```

| Command | Does |
| --- | --- |
| `luna files get <TYPE> <KEY> <BUCKET> <PATH>` | Downloads a file. `-o -` writes it to standard output |
| `luna files put <TYPE> <KEY> <BUCKET> <PATH> <FILE>` | Uploads a file, replacing what is at that path |
| `luna files delete <TYPE> <KEY> <BUCKET> <PATH>` | Deletes a file after asking. It cannot be undone |
| `luna files url <TYPE> <KEY> <BUCKET> <PATH>` | Prints a signed URL that anyone can download from |

A signed URL lasts one hour unless you pass `--expires`, and at most 7 days. [Store files](/files-and-code/store-files) explains buckets.

## Look at indexes

[`luna indexes`](/cli/indexes) lists the environment's indexes, and the name of one shows it in full. Indexes are read only here, since your code and `luna deploy` make and change them.

```bash
luna indexes find <INDEX> --partition <VALUE> --search "<WORDS>"
```

`luna indexes find` reads the rows of one partition, up to 50 unless you pass `--limit`. [Query across lunas](/data/query-across-lunas) explains indexes.

## Look at sandboxes

[`luna sandboxes list`](/cli/sandboxes) lists the sandboxes of the environment's lunas, or of one type when you name it.

`luna sandboxes stop` powers a running sandbox off and keeps its disks, and the next request to it boots it again. `luna sandboxes delete` removes a sandbox with its disks after asking, and it cannot be undone.

```bash
luna sandboxes stop <TYPE> <KEY> <NAME>
```

## Browse in the Console

The Console shows the same data. On an environment's page, select a luna type, then a table under **Data** or a bucket under **Files**.

## Next steps

- [Fork a luna](/develop/fork-a-luna) gives you a copy to edit instead of the original.
- [Restore to an earlier moment](/develop/restore-to-an-earlier-moment) rewinds a luna after a wrong edit.
- [Query across lunas](/data/query-across-lunas) shows how indexes collect rows from many lunas.
