SF command to Logout of connected orgs

Log out from connected Default org

Run the following salesforce cli command to logout from current active org. After running this command it will asks for confirmation, then enter Y to Yes and N to No.
sf org logout
// no confirmation needed 
sf org logout -p

Log out of the org with username

Logout with specific username.
sf org logout -o me@my.org

Log out of all orgs

salesforce command to logout form all connected orgs.
sf org logout --all

If you log out of a scratch org without having access to its password, you can't access the scratch org again

Flags:
  • -p/ --no-prompt : Don't prompt for confirmation.
  • -o/--target-org : Username or alias of the target org.

Source:
https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_org_commands_unified.htm#cli_reference_org_logout_unified

Labels:
Join the conversation