org Commands

Use the org commands to manage the orgs you use with Salesforce DX. Create and delete scratch orgs, list your created and authorized orgs, and open orgs in your browser.

org:create

Creates a scratch org using values specified in a configuration file or key=value pairs that you specify on the command line. Values specified on the command line override values in the configuration file.

Command Syntax

sfdx force:org:create
[-f DEFINITIONFILE]
[-n]
[-i CLIENTID]
[-s]
[-a SETALIAS]
[-w WAIT]
[-v TARGETDEVHUBUSERNAME]
[--json]
[--loglevel LOGLEVEL]

Parameters

-f | --definitionfile DEFINITIONFILE
Optional




Path to a scratch org definition file. Either --definitionfile or --definitionjson is required.

Type: filepath
-n | --nonamespace
Optional




Creates the scratch org with no namespace. Useful when using a scratch org to test installations of packages with namespaces.

Type: flag
-i | --clientid CLIENTID
Optional




Connected app consumer key, as configured in your Dev Hub.

Type: string
-s | --setdefaultusername
Optional




Sets the created org as the default username.

Type: flag
-a | --setalias SETALIAS
Optional




Set an alias for for the created scratch org.

Type: string
-w | --wait WAIT
Optional




Sets the streaming client socket timeout, in minutes.If the streaming client socket has no contact from the server for a number of minutes, the client exits. Specify a longer wait time if timeouts occur frequently.

Type: minutes
Default value: 6
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional




A username for the target Dev Hub org. Overrides default Dev Hub org.

Type: string
--json
Optional




Format output as JSON.

Type: flag
--loglevel LOGLEVEL
Optional




The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.

Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: error

Help for org:create

To set up a connected app for your new scratch org, specify the value that was returned when you created a connected app in your Dev Hub org as --clientid.

Examples:

org:delete

Marks a scratch org for deletion.

Command Syntax

sfdx force:org:delete
[-p]
-u TARGETUSERNAME
[--json]
[--loglevel LOGLEVEL]

Parameters

-p | --noprompt
Optional




No prompt to confirm deletion.

Type: flag
-u | --targetusername TARGETUSERNAME
Required




Username for the target org.

Type: string
--json
Optional




Format output as JSON.

Type: flag
--loglevel LOGLEVEL
Optional




The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.

Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: error

Help for org:delete

To mark the org for deletion without being prompted to confirm, specify --noprompt.

Examples:

org:display

Gets the description for the current or target org.

Command Syntax

sfdx force:org:display
[-u TARGETUSERNAME]
[--json]
[--loglevel LOGLEVEL]
[--verbose]

Parameters

-u | --targetusername TARGETUSERNAME
Optional




Username for the target org. Overrides the default target org.

Type: string
--json
Optional




Format output as JSON.

Type: flag
--loglevel LOGLEVEL
Optional




The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.

Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: error
--verbose
Optional




Emit additional command output to stdout.

Type: flag

Help for org:display

Output includes your access token, client ID, connected status, org ID, instance URL, username, and alias, if applicable. Use --verbose to include the SFDX auth URL.

Examples:

org:list

Lists all orgs that the Salesforce CLI has created or authenticated to.

Command Syntax

sfdx force:org:list
[--all]
[--clean]
[-p]
[--json]
[--loglevel LOGLEVEL]

Parameters

--all
Optional




Lists all authenticated orgs, including expired, deleted, and unknown-status scratch orgs.

Type: flag
--clean
Optional




Remove all local org authorizations for deleted or expired orgs.

Type: flag
-p | --noprompt
Optional




Do not prompt for confirmation.

Type: flag
--json
Optional




Format output as JSON.

Type: flag
--loglevel LOGLEVEL
Optional




The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.

Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: error

Help for org:list

Examples:

org:open

Opens an org in your browser.

Command Syntax

sfdx force:org:open
[-p PATH]
[-r]
[-u TARGETUSERNAME]
[--json]
[--loglevel LOGLEVEL]

Parameters

-p | --path PATH
Optional




Navigation URL path (not including domain).

Type: string
-r | --urlonly
Optional




Displays a navigation URL, but doesn’t launch your browser.

Type: flag
-u | --targetusername TARGETUSERNAME
Optional




Username for the target org. Overrides the default target org.

Type: string
--json
Optional




Format output as JSON.

Type: flag
--loglevel LOGLEVEL
Optional




The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.

Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: error

Help for org:open

Opens your default scratch org, or another org that you specify.

To open a specific page, specify the portion of the URL after "yourInstance.salesforce.com/" as --path.

For example, specify "--path one/one.app" to open Lightning Experience, or specify "--path /apex/YourPage" to open a Visualforce page.

To generate a URL but not launch your browser, specify --urlonly.

Examples: