Salesforce CLI Cheatsheet

The most used sf commands, ready to copy and paste.

Fill in your values

Enter your own values below and every matching command updates automatically.

Create a project directory

sf project generate --name <Project Directory Name>

Authorize an Org using a Browser

sf org login web --alias <Org Alias>

Authorize an Org making it the default org

sf org login web --alias <Org Alias> --set-default

Create Scratch org that expires after 30 days

sf org create scratch --duration-days=30 --alias <Scratch Org Alias> --set-default --target-dev-hub

Retrieve source from org preview

sf project retrieve preview

Actually retrieve source from org

sf project retrieve start

Deploy changed source to org

sf project deploy start

Update version of the Salesforce CLI

sf update

Delete a scratch org

sf org delete scratch --target-org <Scratch Org Alias>

List your orgs

sf org list

Open the Org in the default browser

sf org open

Set your default org

sf config set target-org <Org Alias>

Set your default DevHub org

sf config set target-dev-hub=<DevHub Org Alias>

No commands match your search.