---
title: "link"
description: "Link current directory to a PgBeam project"
canonical: "https://pgbeam.com/docs/cli/projects/link"
last-updated: "2026-10-29T19:01:20.000Z"
---

# link

> Link current directory to a PgBeam project

URL: https://pgbeam.com/docs/cli/projects/link

{/* Auto-generated from CLI commands. Do not edit. Run `pnpm generate:cli-docs` to regenerate. */}

Link the current working directory to a PgBeam project by creating a `.pgbeam` configuration file. This saves the project ID so subsequent commands (like `pgbeam db list` or `pgbeam projects inspect`) automatically use the linked project without requiring `--project`. An interactive selector is shown to choose from your organization's projects.

## Usage

```bash
pgbeam link
```

> **Global options**
>
> All [global options](/docs/cli/global-options) (`--token`, `--profile`,
> `--project`, `--org`, `--json`, `--no-color`, `--no-trunc`, `--debug`) are
> also available on this command.

## Examples

```bash
# Link the current directory to a project
pgbeam link

# Link with a specific organization
pgbeam link --org org_xxx
```

## Output

Prints a success message with the linked project ID and suggests `pgbeam db list` as a next step. A `.pgbeam` file is created in the current directory.