Complete reference for all prev CLI commands.

prev create

Create a new preview environment from local code, a remote source, or a Docker image.

Usage

prev create [path] [flags]

Arguments

  • path — Directory containing your project (default: current directory)

Flags

FlagDescriptionDefault
%%INLINECODE_1%%Project directory (alternative to positional arg)%%INLINECODE_2%%
%%INLINECODE_3%%Deploy from a remote source URL
%%INLINECODE_4%%Deploy a Docker image directly
%%INLINECODE_5%%Custom subdomain for the preview URLRandom
%%INLINECODE_6%%Use a registered custom domain
%%INLINECODE_7%%Label for the environment (e.g., "frontend-redesign")
%%INLINECODE_8%%Time-to-live (e.g., 1h, 24h, 7d)24h
%%INLINECODE_9%%Project type overrideAuto-detected
%%INLINECODE_10%%Custom startup command
%%INLINECODE_11%%Container port to exposeAuto-detected
%%INLINECODE_12%%HTTP Basic Auth protection
%%INLINECODE_13%%Deploy region (us, eu, apac, latam)us
%%INLINECODE_14%%IP allowlist in CIDR notation
%%INLINECODE_15%%Use a saved deployment template
%%INLINECODE_16%%Subdomain naming style: %%INLINECODE_17%% or %%INLINECODE_18%%alphanumeric
%%INLINECODE_19%%Update existing environment with new code
%%INLINECODE_20%%Output format: url or jsonPretty

Examples

Deploy current directory:

prev create .

Deploy with custom subdomain, label, and extended TTL:

prev create . --subdomain my-demo --label "client-review" --ttl 7d

Deploy from GitHub:

prev create --source github.com/user/repo

Deploy a Docker image:

prev create --image nginx:latest --port 80

Deploy with password protection:

prev create . --credentials admin:secret123

Deploy to EU region with IP restriction (Business plan):

prev create . --region eu --ip-allow 10.0.0.0/8

Use a saved deployment template (Business plan):

prev create . --template staging

Update an existing environment with new code (same URL):

prev create --to my-demo .

Deploy with a memorable subdomain (Ubuntu-style naming):

prev create . --naming ubuntu

This generates adjective-animal subdomains like cosmic-falcon.us.prev.sh or arctic-penguin.eu.prev.sh instead of the default random alphanumeric style.

Output only the URL (useful for scripts):

prev create . -o url

Supported Source Types

SourceExample
Local directory%%INLINECODE_23%%
GitHub%%INLINECODE_24%%
Git URL%%INLINECODE_25%%
FTP%%INLINECODE_26%%
SSH%%INLINECODE_27%%
Docker image%%INLINECODE_28%%

prev list

List all active preview environments.

Usage

prev list

Output

Displays a table of all your active environments including:

  • Environment ID
  • URL
  • Status (running, starting, creating, failed)
  • Region
  • Time remaining
  • Usage progress (current / max environments)

prev env

Show detailed information about a specific environment.

Usage

prev env <environment-id>

Output

  • Environment ID
  • Full URL
  • Status
  • TTL duration
  • Created date and time
  • Expiration date and time with remaining time

prev destroy

Destroy one or all preview environments.

Usage

Destroy a specific environment:

prev destroy <environment-id>

Destroy all environments (with confirmation):

prev destroy all

When using destroy all, the CLI will ask for confirmation before proceeding.


prev subscription

Display your current subscription plan and status.

Usage

prev subscription

Output

  • Email address
  • Current plan name
  • Subscription status (active, trialing, canceled)

Global Options

These flags can be used with any command:

FlagDescriptionDefault
%%INLINECODE_30%%API key for authenticationFrom env/config
%%INLINECODE_31%%API endpoint URLhttps://api.prev.sh
%%INLINECODE_32%%Path to config fileAuto-discovered
%%INLINECODE_33%%Show help
%%INLINECODE_34%%Show CLI version