9

Now that DX has been around for a minute and it's almost 2 years since this question was posed from a CLI perspective, I thought it would be worth asking. Is there yet a convenient way to remove expired scratch orgs from my list within VS Code?

enter image description here

Currently when I click on the current default org (above), I get the following list (below). These are all outdated, I wish they would auto remove themselves, but since they apparently don't, what is the best way to manage them? enter image description here

1
  • If you want a more gui-oriented solution, you could create a VS Code extension that executes that command in Javascript that is accessible through the VS Code command palette, or extend the default cli with a dx extension. Either is feasible
    – trebleCode
    Apr 19, 2019 at 0:39

1 Answer 1

20

There's no GUI for it, but you can go to the terminal and type in the following command:

sfdx force:org:list --clean

This will clear up all expired scratch orgs.

2
  • Do the above command delete all orgs including active too?
    – RKCY
    Jul 20, 2020 at 17:58
  • @RKCY No, it will only delete orgs with INVALID_GRANT (either the org was deleted or the session is no longer valid).
    – sfdcfox
    Jul 20, 2020 at 18:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.