Press enter to see results or esc to cancel.

How to remove/delete all local org authorizations for non-active/expired scratch orgs in Salesforce CLI

Hello Everyone, In this blog post we will see how we can remove/delete the expired scratch orgs

To check the connected orgs on your local machine you can use the below command.

  • sfdx force:org:list –all

–all parameter will include expired, deleted, and unknown-status scratch orgs.

Example:

I am using the command in my local machine and I ended up having a couple of expired scratch orgs orgs.

expired scratch orgs

Use the below command to remove/delete the expired, deleted, and unknown-status scratch orgs.

sfdx force:org:list –clean

Output:

scratch orgs --clean

Please observe that all the expired scratch orgs are removed from the list and now the CLI output looks clean.