# Discovery commands (/docs/v0.4/cli/discovery)



Every list and inspect command accepts `--format table` or `--format json`.
Table is the default.

## List [#list]

```bash
koshi list-sessions
koshi list-sessions --remote work
koshi list-tabs --session <NAME_OR_ID>
koshi list-panes --session <NAME_OR_ID>
koshi list-clients --session <NAME_OR_ID>
```

| Command         | Output                                              |
| --------------- | --------------------------------------------------- |
| `list-sessions` | Session ids and names, and the machine each runs on |
| `list-tabs`     | Tab ids, names, indexes, and owning sessions        |
| `list-panes`    | Pane, tab, and session ids and names                |
| `list-clients`  | Client ids and owning sessions                      |

For scripts:

```bash
koshi list-panes --format json
```

## Inspect [#inspect]

```bash
koshi inspect session <NAME_OR_ID>
koshi inspect tab <NAME_OR_ID>
koshi inspect pane <PANE_ID>
koshi inspect client <CLIENT_ID>
```

`inspect` prints one full record. Add `--format json` for machine-readable
output. `inspect pane` shows a pane's command in full, arguments included.

## The server column [#the-server-column]

`list-sessions` names each session's machine: `local` for a session on this
machine, else the saved server it runs on. A bare `koshi list-sessions` sweeps
every saved server and appends what answered. The sweep waits two seconds in
total, not two seconds per server. A server that refused the saved secret, and
a server that did not answer, are named on standard error and their sessions
are left out. See [Remote sessions](/docs/v0.4/remote).

## Names and ids [#names-and-ids]

Session and tab arguments take either the generated name or the printed id. An
id is never re-read as a name. A name that several targets share is refused,
and the error lists every matching id. Pane and client arguments take ids only.

## Ending a session [#ending-a-session]

`koshi kill-session` lives on [Session commands](/docs/v0.4/cli/sessions),
beside `attach` and `detach`.

## Reading running state [#reading-running-state]

For the whole picture — every session's tabs, panes, and clients at once, or a
tab's solved rectangles — use
[`koshi debug`](/docs/v0.4/cli/debug).
