# CLI reference

> Every pier command in the five help groups, with the global flags

URL: https://pier.run/docs/cli/reference

Generated from the CLI's own command tree, so it cannot disagree with `pier --help`.
One page per top-level command; subcommands are sections on that page. The whole
reference on one page: [all commands](/docs/cli/reference/all).

## Global flags

| Flag                | Value    | Default | Description                                                                            |
| ------------------- | -------- | ------- | -------------------------------------------------------------------------------------- |
| `-v`, `--version`   |          |         | Print version                                                                          |
| `-j`, `--json`      |          |         | Output as JSON                                                                         |
| `--no-color`        |          |         | Disable colored output (env `NO_COLOR`)                                                |
| `-w`, `--workspace` | `STRING` |         | Override default workspace (name or ID)                                                |
| `-p`, `--project`   | `STRING` |         | Override default project (name, slug, or ID) (env `PIER_PROJECT`)                      |
| `-e`, `--env`       | `STRING` |         | Target this environment for this command only (slug); use 'pier use' to switch         |
| `--profile`         | `STRING` |         | Use a named session profile for this invocation (e.g. local, dev) (env `PIER_PROFILE`) |
| `--no-state`        |          |         | Ignore saved selections, always prompt                                                 |

## Inspect the environment

| Command                                       | Does                                                                                                    |
| --------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| [`pier status`](/docs/cli/reference/status)   | Project state, resource counts, config drift                                                            |
| [`pier logs`](/docs/cli/reference/logs)       | Read or follow logs for an app, a Postgres, or the whole environment                                    |
| [`pier events`](/docs/cli/reference/events)   | Show or watch events for a resource, the environment, the project or the workspace                      |
| [`pier monitor`](/docs/cli/reference/monitor) | Monitor a resource or the whole environment: live snapshot, --range summary, --metric drill-down        |
| [`pier deploys`](/docs/cli/reference/deploys) | Deploy history (apps + sites), incl. build logs                                                         |
| [`pier ls`](/docs/cli/reference/ls)           | What's in the environment; a kind (apps, sites, pg, buckets, volumes, domains) narrows it               |
| [`pier info`](/docs/cli/reference/info)       | One resource in full: an app or site with its targets, one target, a Postgres, bucket, volume or domain |

## Change the environment

| Command                                         | Does                                                                       |
| ----------------------------------------------- | -------------------------------------------------------------------------- |
| [`pier apply`](/docs/cli/reference/apply)       | Converge pier.yaml: add, set and remove resources — never rolls a workload |
| [`pier deploy`](/docs/cli/reference/deploy)     | Build and roll changed apps and sites (implies apply)                      |
| [`pier add`](/docs/cli/reference/add)           | Add a resource                                                             |
| [`pier set`](/docs/cli/reference/set)           | Change a resource's config                                                 |
| [`pier rm`](/docs/cli/reference/rm)             | Remove a resource                                                          |
| [`pier trash`](/docs/cli/reference/trash)       | Removed resources in their recovery window: list, restore, purge           |
| [`pier copy`](/docs/cli/reference/copy)         | Copy a resource to another environment                                     |
| [`pier rename`](/docs/cli/reference/rename)     | Rename a resource in place (non-destructive)                               |
| [`pier promote`](/docs/cli/reference/promote)   | Make a target the primary of its app or site                               |
| [`pier restart`](/docs/cli/reference/restart)   | Restart an app or a Postgres instance                                      |
| [`pier rollback`](/docs/cli/reference/rollback) | Roll an app or site back to a previous deploy                              |
| [`pier pause`](/docs/cli/reference/pause)       | Pause a resource, environment, project or workspace (recoverable)          |
| [`pier resume`](/docs/cli/reference/resume)     | Resume a paused resource, environment, project or workspace                |

## Connect & data

| Command                                           | Does                                         |
| ------------------------------------------------- | -------------------------------------------- |
| [`pier ssh`](/docs/cli/reference/ssh)             | Open a shell in a running app                |
| [`pier psql`](/docs/cli/reference/psql)           | Open a psql shell to a Postgres instance     |
| [`pier vars`](/docs/cli/reference/vars)           | Environment variables                        |
| [`pier routes`](/docs/cli/reference/routes)       | Site routing rules                           |
| [`pier pg`](/docs/cli/reference/pg)               | Postgres tools                               |
| [`pier objects`](/docs/cli/reference/objects)     | Bucket objects (data plane)                  |
| [`pier snapshots`](/docs/cli/reference/snapshots) | Volume snapshots                             |
| [`pier backups`](/docs/cli/reference/backups)     | Postgres backups                             |
| [`pier github`](/docs/cli/reference/github)       | GitHub push-to-deploy                        |
| [`pier dev`](/docs/cli/reference/dev)             | Run the current environment locally (docker) |

## Project & scope

| Command                                                 | Does                                                    |
| ------------------------------------------------------- | ------------------------------------------------------- |
| [`pier config`](/docs/cli/reference/config)             | pier.yaml lifecycle: init, sync, diff, validate         |
| [`pier use`](/docs/cli/reference/use)                   | Switch the active environment                           |
| [`pier projects`](/docs/cli/reference/projects)         | Projects: list, add, inspect, remove, pause, switch     |
| [`pier environments`](/docs/cli/reference/environments) | Environments: list, add, pause (switch with 'pier use') |
| [`pier workspaces`](/docs/cli/reference/workspaces)     | Workspaces: switch, pause, resume                       |

## CLI & account

| Command                                           | Does                                        |
| ------------------------------------------------- | ------------------------------------------- |
| [`pier login`](/docs/cli/reference/login)         | Authenticate with the controller            |
| [`pier logout`](/docs/cli/reference/logout)       | Log out and clear session                   |
| [`pier whoami`](/docs/cli/reference/whoami)       | Show current user                           |
| [`pier profiles`](/docs/cli/reference/profiles)   | Session profiles (one login per controller) |
| [`pier billing`](/docs/cli/reference/billing)     | Billing state and overage cap               |
| [`pier ssh-key`](/docs/cli/reference/ssh-key)     | Generate SSH certificate for shell access   |
| [`pier upgrade`](/docs/cli/reference/upgrade)     | Upgrade the CLI to the latest version       |
| [`pier uninstall`](/docs/cli/reference/uninstall) | Uninstall the Pier CLI and remove all data  |
