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

# cockroach Commands Overview

This page introduces the `cockroach` commands for configuring, starting, and managing a CockroachDB cluster, as well as environment variables that can be used in place of certain flags.

You can run `cockroach help` in your shell to get similar guidance.

## Commands

| Command | Usage |
| - | - |
| [`cockroach start`](/docs/stable/cockroach-start) | Start a node as part of a multi-node cluster. |
| [`cockroach init`](/docs/stable/cockroach-init) | Initialize a multi-node cluster. |
| [`cockroach start-single-node`](/docs/stable/cockroach-start-single-node) | Start a single-node cluster. |
| [`cockroach cert`](/docs/stable/cockroach-cert) | Create CA, node, and client certificates. |
| [`cockroach sql`](/docs/stable/cockroach-sql) | Use the built-in SQL client. |
| [`cockroach sqlfmt`](/docs/stable/cockroach-sqlfmt) | Reformat SQL queries for enhanced clarity. |
| [`cockroach node`](/docs/stable/cockroach-node) | List node IDs, show their status, decommission nodes for removal, or recommission nodes. |
| [`cockroach nodelocal upload`](/docs/stable/cockroach-nodelocal-upload) | Upload a file to the `externalIODir` on a node's local file system. |
| [`cockroach auth-session`](/docs/stable/cockroach-auth-session) | Create and manage web sessions and authentication tokens to the HTTP interface from the command line. |
| [`cockroach demo`](/docs/stable/cockroach-demo) | Start a temporary, in-memory CockroachDB cluster, and open an interactive SQL shell to it. |
| [`cockroach debug ballast`](/docs/stable/cockroach-debug-ballast) | Create a large, unused file in a node's storage directory that you can delete if the node runs out of disk space. |
| [`cockroach debug encryption-active-key`](/docs/stable/cockroach-debug-encryption-active-key) | View the encryption algorithm and store key. |
| [`cockroach debug job-trace`](/docs/stable/cockroach-debug-job-trace) | Generate trace payloads for an executing job from a particular node. |
| [`cockroach debug list-files`](/docs/stable/cockroach-debug-list-files) | Show the files that will be collected by using `cockroach debug zip`. |
| [`cockroach debug merge-logs`](/docs/stable/cockroach-debug-merge-logs) | Merge log files from multiple nodes into a single time-ordered stream of messages with an added per-message prefix to indicate the corresponding node. |
| [`cockroach debug pebble db analyze-data`](/docs/stable/cockroach-debug-pebble-db-analyze-data) | Analyze Pebble data to compare compression algorithms and output results as a CSV file. |
| [`cockroach debug tsdump`](/docs/stable/cockroach-debug-tsdump) | Generate a diagnostic dump of timeseries metrics that can help Cockroach Labs troubleshoot issues with your cluster. |
| [`cockroach debug upload`](/docs/stable/cockroach-debug-upload) | Upload a `debug.zip` file generated by `cockroach debug zip` to Cockroach Labs support. |
| [`cockroach debug zip`](/docs/stable/cockroach-debug-zip) | Generate a `.zip` file that can help Cockroach Labs troubleshoot issues with your cluster. |
| [`cockroach convert-url`](/docs/stable/connection-parameters#convert-a-url-for-different-drivers) | Convert a connection URL to a format recognized by a [supported client driver](/docs/stable/third-party-database-tools.md#drivers). |
| [`cockroach gen`](/docs/stable/cockroach-gen) | Generate man pages, a bash completion file, example SQL data, or an HAProxy configuration file for a running cluster. |
| [`cockroach statement-diag`](/docs/stable/cockroach-statement-diag) | Manage and download statement diagnostics bundles. |
| [`cockroach userfile upload`](/docs/stable/cockroach-userfile-upload) | Upload a file to user-scoped file storage. |
| [`cockroach userfile list`](/docs/stable/cockroach-userfile-list) | List the files stored in the user-scoped file storage. |
| [`cockroach userfile get`](/docs/stable/cockroach-userfile-get) | Fetch a file from the user-scoped file storage. |
| [`cockroach userfile delete`](/docs/stable/cockroach-userfile-delete) | Delete the files stored in the user-scoped file storage. |
| [`cockroach version`](/docs/stable/cockroach-version) | Output CockroachDB version details. |
| [`cockroach workload`](/docs/stable/cockroach-workload) | Run a built-in load generator against a cluster. |

## Environment variables

For many common `cockroach` flags, such as `--port` and `--user`, you can set environment variables once instead of manually passing the flags each time you execute commands.

* To find out which flags support environment variables, see the documentation for each [command](#commands).
* To output the current configuration of CockroachDB and other environment variables, run `env`.
* When a node uses environment variables on [startup](/docs/stable/cockroach-start.md), the variable names are printed to the node's logs; however, the variable values are not.

CockroachDB prioritizes command flags, environment variables, and defaults as follows:

1. If a flag is set for a command, CockroachDB uses it.
2. If a flag is not set for a command, CockroachDB uses the corresponding environment variable.
3. If neither the flag nor environment variable is set, CockroachDB uses the default for the flag.
4. If there's no flag default, CockroachDB gives an error.

For more details, see [Client Connection Parameters](/docs/stable/connection-parameters.md).
