12

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
    Commented Apr 19, 2019 at 0:39

2 Answers 2

28

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
    Commented 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
    Commented Jul 20, 2020 at 18:21
3

Even though

sfdx force:org:list --clean

still works, it has been deprecated and you should instead use

sf org list --clean

You can read more about it in this article

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .