I have a trailhead playground org (not a scratch org) for which I've created multiple aliases and now I'd like to know how I can keep one and delete all the others using the Salesforce CLI? Also, is there a command that allows renaming an org's alias?

1 Answer 1


To see all the orgs you have with the aliases associated use the command:

sfdx force:org:list 

To see all aliases you set:

sfdx alias:list

To remove the alias alone, you can use the command:

sfdx alias:unset <aliasName1> <aliasName2> <aliasName3> ...

this will remove the alias, but keep the org.

If you want to remove the org you can logout of the org using:

sfdx force:auth:logout -u <aliasOrUsername>

this will remove it from your list until you authorize it again.

to rename an alias, you can use the command

sfdx alias:set <newAlias>=<usernameOrValue> 

if the org already has an alias, I don't believe that the newAlias will override that alias displayed in your org list, so best way to go about it would be to first unset the alias for a username and then reset it as necessary.

hope that helps answer your question.


Salesforce CLI Command Reference

alias Namespace

  • Love this answer, Thanks!!
    – Bahman.A
    Mar 10, 2021 at 21:08

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.