config Commands

Use the config commands to view and set your Salesforce CLI configuration values. Set your default Dev Hub and scratch org, and your default instance URL, either globally or at the project level.

force:config:get

Gets the Salesforce CLI configuration values for your default scratch org, your default Dev Hub org, your default instance URL, or any combination of the three.

Command Syntax

sfdx force:config:get
[--json]
[--loglevel LOGLEVEL]
[--verbose]

Parameters

--json
Optional

Format output as JSON.

Type: boolean
--loglevel LOGLEVEL
Optional

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

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
Default value: warn
--verbose
Optional

Emit additional command output to stdout.

Type: boolean

Help for force:config:get

To see your default scratch org username, include "defaultusername".

To see your default Dev Hub, include "defaultdevhubusername".

To see your default instance URL, include "instanceUrl".

To see the locations where your values are set, include the --verbose flag.

Examples:

1$ sfdx force:config:get defaultusername
1$ sfdx force:config:get defaultusername defaultdevhubusername instanceUrl
1$ sfdx force:config:get defaultusername defaultdevhubusername --verbose

force:config:list

Lists the configuration variables for the Salesforce CLI.

Command Syntax

sfdx force:config:list
[--json]
[--loglevel LOGLEVEL]

Parameters

--json
Optional

Format output as JSON.

Type: boolean
--loglevel LOGLEVEL
Optional

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

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
Default value: warn

Help for force:config:list

Lists the config variables that the Salesforce CLI uses for various commands and tasks.

force:config:set

Sets the local and global configuration variables for the Salesforce CLI.

Command Syntax

sfdx force:config:set
[--json]
[--loglevel LOGLEVEL]
[-g]

Parameters

--json
Optional

Format output as JSON.

Type: boolean
--loglevel LOGLEVEL
Optional

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

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
Default value: warn
-g | --global
Optional

Sets the configuration variables globally, so they can be used from any directory.

Type: boolean

Help for force:config:set

Sets the configuration variables that the Salesforce CLI uses for various commands and tasks. Local variables apply only to your current project. Global variables apply in any directory.

Examples:

1$ sfdx force:config:set defaultusername=me@my.org defaultdevhubusername=me@myhub.org
1$ sfdx force:config:set defaultdevhubusername=me@myhub.org -g