> For the complete documentation index, see [llms.txt](https://docs.keeper.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.keeper.io/keeperpam/secrets-manager/secrets-manager-command-line-interface/shell-command.md).

# Shell Command

Run the CLI in an interactive shell

**Description:** Run the CLI in an interactive shell (REPL). Once inside the shell, run any `ksm` command by typing its name directly, without the `ksm` prefix, and without re-authenticating between commands.

format: **`ksm shell`**

**Example:**

```
$ ksm shell

██╗  ██╗███████╗███╗   ███╗     ██████╗██╗     ██╗
██║ ██╔╝██╔════╝████╗ ████║    ██╔════╝██║     ██║
█████╔╝ ███████╗██╔████╔██║    ██║     ██║     ██║
██╔═██╗ ╚════██║██║╚██╔╝██║    ██║     ██║     ██║
██║  ██╗███████║██║ ╚═╝ ██║    ╚██████╗███████╗██║
╚═╝  ╚═╝╚══════╝╚═╝     ╚═╝     ╚═════╝╚══════╝╚═╝

Current Version: 1.5.0

Running in shell mode. Type 'quit' to exit.

KSM Shell (? for help) > secret list

 UID                     Record Type  Title
 ----------------------- ------------ -----------
 A_ok8pstlrCr5o84Ac9-hg  login        My Login

KSM Shell (? for help) > quit
```

{% hint style="info" %}
Once inside the shell, run every `ksm` sub-command by its bare name: `secret list`, `folder list`, `profile list`, and so on. Do not prefix commands with `ksm` while already in the shell.
{% endhint %}

***

## Sub-Commands (available inside the shell)

| Sub-Command | Description                                                                   |
| ----------- | ----------------------------------------------------------------------------- |
| `quit`      | Exit the shell and return to your terminal.                                   |
| `help`      | Show the top-level command list and options, the same output as `ksm --help`. |

{% hint style="info" %}
Type `?` at the shell prompt for the same command list and options that `help` and `ksm --help` show.
{% endhint %}

***

## Session-Wide Options

Any global option passed when starting the shell (`--ini-file`, `--profile-name`/`-p`, `--output`/`-o`, `--color`/`--no-color`, `--cache`/`--no-cache`, `--log-level`) applies to every command in that session. You do not need to repeat it on each command. An option typed on an individual shell line overrides the session value for that line only.

**Example:**

```
$ ksm --profile-name production shell

KSM Shell (? for help) > secret list
# uses the "production" profile

KSM Shell (? for help) > secret list --profile-name staging
# uses "staging" for this line only

KSM Shell (? for help) > secret list
# back to "production"
```

***

## Platform Notes

{% hint style="info" %}
**Windows:** File paths containing backslashes (for example `--ini-file C:\keeper\keeper.ini`) and secret values or arguments containing `#` are parsed correctly inside the shell on Windows.
{% endhint %}

{% hint style="info" %}
If the terminal cannot display the banner's box-drawing characters (for example, when output is piped), the shell uses a plain-text banner instead. This does not affect command functionality.
{% endhint %}

***


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.keeper.io/keeperpam/secrets-manager/secrets-manager-command-line-interface/shell-command.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
