LinuxCommandLibrary

sfdx

Develop, manage, and deploy Salesforce applications

TLDR

Authorize a Salesforce Organization

$ sfdx force:auth:web:login --setalias [organization] --instanceurl [organization_url]
copy


List all authorized organizations
$ sfdx force:org:list
copy


Open a specific organization in the default web browser
$ sfdx force:org:open --targetusername [organization]
copy


Display information about a specific organization
$ sfdx force:org:display --targetusername [organization]
copy


Push source metadata to an Organization
$ sfdx force:source:push --targetusername [organization]
copy


Pull source metadata from an Organization
$ sfdx force:source:pull --targetusername [organization]
copy


Generate a password for the organization's logged-in user
$ sfdx force:user:password:generate --targetusername [organization]
copy


Assign a permission set for the organization's logged-in user
$ sfdx force:user:permset:assign --permsetname [permission_set_name] --targetusername [organization]
copy

SYNOPSIS

sfdx [global options] command [command options]

PARAMETERS

--help
    Displays help information for the sfdx command or a specific subcommand.

--version
    Displays the version of the sfdx CLI.

--json
    Outputs results in JSON format.

--loglevel level
    Sets the logging level (e.g., trace, debug, info, warn, error, fatal).

--target-org username|alias|orgId
    Specifies the target Salesforce org using username, alias, or org ID.

--apiversion version
    Specifies the API version to use for the command.

force:*
    Includes the available force commands.

org:*
    Includes the available org management commands.

project:*
    Includes the available project commands.

DESCRIPTION

The sfdx command is the command-line interface (CLI) for Salesforce development.
It allows developers and administrators to interact with Salesforce orgs (scratch orgs, sandboxes, or production environments) from the terminal.
sfdx enables automating tasks like creating scratch orgs, deploying code, running tests, importing data, and managing Salesforce DX projects.
It's a powerful tool for continuous integration/continuous delivery (CI/CD) pipelines and streamlining development workflows.
The CLI is extensible through plugins, allowing you to add custom functionality or integrate with other tools.

CAVEATS

Many sfdx commands require a Salesforce DX project to be initialized. Be sure to use "sfdx force:project:create" command to create the project initially. Authentication with a Salesforce org is also a prerequisite for many operations.
Some commands might have specific requirements based on the Salesforce edition or enabled features.

PLUGINS

The sfdx cli can be extended via plugins.
You can install them via npm.
You can create own plugin with Javascript or Typescript.

AUTHENTICATION

The sfdx command can be used with various authentication methods.

  • Web-based authentication flow via "sfdx auth:web:login"
  • JWT authentication via "sfdx auth:jwt:grant"
  • Auth URL via "sfdx auth:sfdxurl:store"

HISTORY

The sfdx CLI evolved from the Force.com CLI (known as "force" command).
It was designed to support the Salesforce DX development model, focusing on source-driven development and continuous integration/continuous delivery (CI/CD).
It has become the standard tool for Salesforce developers and administrators.

Copied to clipboard