The Salesforce CLI (sf, formerly sfdx) is a command-line tool for interacting with Salesforce orgs. Foundational for Salesforce DX and CI/CD.
Common commands:
sf org login web -a myorg
sf project retrieve start
sf project deploy start
sf project deploy validate
sf apex run test --result-format human
sf data query --query "SELECT Id FROM Account LIMIT 10"
sf org openWhy it matters: source-driven development (track metadata in Git, deploy via CLI), CI/CD integration with GitHub Actions/GitLab/Bitbucket, scratch org provisioning for unit testing, cross-org operations, scripting.
Pairs with Salesforce Extensions for VS Code (which use the CLI under the hood). VS Code is the UI; CLI is for automation.
Modern Salesforce projects don't use the Setup UI for deployments — they use the CLI from version-controlled source.