Delete Your Scratch Org

All good things come to an end, right? In the case of your first scratch org, we’re going to accellerate the process and delete it right now.

In this exercise, you will…

  • Use the Salesforce CLI to delete your scratch org
  • Use the clear command to keep your terminal easy-to-read

Use the Salesforce CLI to delete your scratch org

When you delete a scratch org, you’ll want to be specific about which one you want to delete. You can do that with the force:org:delete command by using the -u flag.

Execute this command:

sfdx force:org:delete -u PkgScratch
Salesforce DX Command / Flags Description
force:org:delete Marks a scratch org for deletion.
-u (targetusername) A username or alias for the target org.

After executing the above, your terminal should look something like this:

  1. The force:org:delete command.
  2. The CLI asking you to confirm that you really want to delete the PkgScratch org.
  3. A message stating that the org was successfully marked for deletion.

Use the clear command to keep your terminal easy-to-read

This is a handy commmand that works in MacOS, Windows, and Linux. Use it to remove old lines from your terminal display if things start feeling too crowded.

Execute this command:

clear

After executing the above, your terminal should look something like this:

Updated: