Skip to main content
Back to blog

10 SF CLI Commands I Use Every Day

Joshua Bambrick··2 min read

After years of working with the Salesforce CLI, certain commands have become second nature. Here are the ones I reach for every single day.

1. Check Org Authentication

Before doing anything else in the morning:

sf org list --all

This shows all authenticated orgs and their status. Expired tokens? You'll catch them here.

2. Open an Org in the Browser

sf org open -o my-dev-org

Simple, but I use it dozens of times a day. Add -p to open a specific page:

sf org open -o my-dev-org -p /lightning/setup/DeployStatus/home

3. Deploy with Validation Only

sf project deploy start -o target-org --dry-run

Always validate before deploying to UAT or production. This runs all the same checks without actually making changes.

4. Check Deploy Status

sf project deploy report -o target-org

When you've kicked off a deployment, this shows you where it stands.

5. Retrieve Specific Components

sf project retrieve start -o my-dev-org -m "ApexClass:MyController"

Much faster than retrieving everything when you just need one file.

6. Run Apex Tests

sf apex run test -o my-dev-org -l RunLocalTests -w 10

The -w 10 flag waits up to 10 minutes for results. Essential for CI pipelines.

7. Generate a Manifest

sf project generate manifest --from-org my-dev-org -o manifest/package.xml

Generates a package.xml from an org's metadata. I use this constantly when setting up new backup branches.

8. Execute Anonymous Apex

sf apex run -o my-dev-org -f scripts/apex/cleanup.apex

Quick data fixes, one-off scripts, debug logging setup — anonymous Apex is incredibly versatile.

9. Query Data

sf data query -o my-dev-org -q "SELECT Id, Name FROM Account LIMIT 5"

SOQL from the command line. Add --json for machine-readable output that you can pipe to other tools.

10. List Metadata Types

sf org list metadata-types -o my-dev-org

When you're not sure what metadata type name to use in your package.xml, this command lists them all.


These ten commands cover probably 80% of my daily CLI usage. Master these and you'll be well on your way to CLI fluency.

What commands are in your daily rotation? I'd love to hear about it — drop me a line.