DocsBlogPricing

Reference

Brev CLI Reference

The Brev CLI wraps SSH to quickly get you in your instance, while also letting you do almost everything you can do from the console from the command line.

Every command has a --help flag if you need to see options.

Installation Instructions

Install the Brev CLI to easily jump in and out of your instances, scale hardware and manage your org:

brew install brevdev/homebrew-brev/brev && brev login

If you had trouble installing let us know in our Discord!

Instance Commands

refresh

Syntax

brev refresh

Description

This command syncs instances that you've created through the UI allowing you to access them through the CLI

Example

$ brev refresh
refreshing brev...
brev has been refreshed

list

Syntax

# print orgs
brev list orgs

# print workspaces within active organization
brev list

# print workspaces within any organization
brev list --org org_name

Description

The list commands lets you see all the workspaces you have created or all workspaces within your organization. You can also use brev ls as an alias

Example

$ brev list 
 NAME                        STATUS   ID         MACHINE                                 
 more-gpus                   STOPPED  qn643e4lo  a2-highgpu-1g:nvidia-tesla-a100:1 (gpu) 
 brev-deployment-box         STOPPED  3xq8vmxn6  n1-standard-16 (gpu)                    
 pytorch-container-finetune  RUNNING  m4tvipac7  n1-highmem-2:nvidia-tesla-t4:1 (gpu)

start

Syntax

brev start {-n | --name}

Description

The brev start lets you start a stopped instance.

Example

$ brev start stable-diffusion-ui
Workspace stable-diffusion-ui is starting.
Note: this can take about a minute. Run 'brev ls' to check status

stop

Syntax

brev stop workspace_name

Description

If you don't plan on using your Brev workspace, you can temporarily pause it by running

brev stop workspace_name

Everything in /home/verb-workspace will be saved when it boots up again.

You can stop multiple workspaces by listing each workspace name

$ brev stop brev-deploy naive-pubsub bar euler54 merge-json
Workspace brev-deploy is stopping.
Note: this can take a few seconds. Run 'brev ls' to check status
Workspace naive-pubsub is stopping.
Note: this can take a few seconds. Run 'brev ls' to check status
Workspace bar is stopping.
Note: this can take a few seconds. Run 'brev ls' to check status
Workspace euler54 is stopping.
Note: this can take a few seconds. Run 'brev ls' to check status
Workspace merge-json is stopping.
Note: this can take a few seconds. Run 'brev ls' to check status

port-forward

Syntax

brev port-forward WS_NAME  [--port LOCAL_PORT:REMOTE_PORT]

Description

port forward allows you to forward a port from a brev workspace to a port on your local machine. For example, if you're running a jupyter notebook on port 8888 on your vm, you could use brev port-forward WS_NAME --port 8888:8888 to access it at localhost:8888

Example

$ brev port-forward brev-docs --port 3000:3000
portforwarding...
localhost:3000 -> brev-docs-xp43:3000
Interactively port forward a workspace:

To interacticely select which port to forward from a brev workspace to your localhost, run brev-port-forward with no flag

$ brev port-forward brev-docs

Ports flag was omitted, running interactive mode!

What port on your Brev machine would you like to forward? 3333
What port should it be on your local machine? 3000

-p 3000:3333
2022/07/14 11:31:30 creating new ssh config
portforwarding...
localhost:3000 -> brev-docs-xp43:3333

delete

Syntax

brev delete [ Workspace Name or ID...

Description

The delete command lets you delete a workspace from your account.

Example

$ brev delete payments-frontend
Deleting workspace payments-frontend.
This can take a few minutes. Run 'brev ls' to check status

Organization Commands

set

Syntax

brev set <org name> [--token] [--skip-browser]

Description

The set command lets you set the organization context for your commands.

Example

$ brev set <org name>

login

Syntax

brev login [--token] [--skip-browser]

Description

This function log's you in to your brev account, and preforms some actions that brev needs to function with you user account such as set up config files and

  • creates ~/.brev/ directory if it does not exist
  • if you don't have an account on brev, the browser step will create one for you
  • on first run asks you onboarding questions
  • on first run asks you to configure ssh keys
  • creates your first org if one does not exist

Example

$ brev logout

logout

Syntax

brev logout

Description

Remove your keys and logout

Example

$ brev logout

ssh-key

Get your ssh keys to add to your git provider.

brev ssh-key

Quick links to add it to Github or Gitlab