Below are the SFDX commands helps to execute/Manage orgs using salesforce CLI.
Salesforce CLI commands in below format :
Ex:
Command — >force:user:create
force —> Namespace
User —> Topic
Create—> Subtopic or method
1) sfdx alias – It is used to manage salesforce username aliases.
Ex: force:alias:list : It will give list of username aliases availabile in salesforce.
Ex: force:alias:set : It will give set of username aliases availabile in salesforce.if multiple aliases then it will give one unique alias.
2) sfdx auth – It is used authorise a salesforce orgs.
Ex: force:auth:list – Get list of authorised salesforce orgs.
Ex: force:auth:list – Logout autorised default org
Ex: force:auth:device:login – Authorised to particular device using device code
3) force Apex – apex commands to create Apex classes, execute anonymous blocks, view your logs, run Apex tests, and view Apex test results.
Ex: $ sfdx force:apex:class:create -n ClassName – Create Apex class in specified directory.
Ex: $ sfdx force:apex:trigger:create -n Triggername – Create Apex trigger in specified directory.
Ex: $ sfdx force:apex:execute -f ~/test.apex – Execute entered code in annonymous salesforce.
Ex: $ sfdx force:apex:test:run -n “learnowntest,Lwctest” -r human – Run test classes using sfdx salesforce CLI Commands.
4) force:community – Create and publish community using salesforce CLI Commands.
Ex: force:community:create – Create salesforce Lighting community using salesforce CLI Commands.
Ex: force:community:publish – publish your changes in Lighting community using salesforce CLI Commands.
5) force:data – We can perform create,delete,update,get records using salforce CLI Commands.
Ex: force:data:record:create – Create or insert record
Ex: force:data:record:delete,force:data:record:update,force:data:record:get – Delete,update and get records using CLI Commands.
Ex: force:data:soql:query – Execute SOQL Query also using CLI.
Ex: force:data:bulk:delete, force:data:bulk:upsert – perform bulk operations on data.
6) force:lightning – Create lighting component, Application,event using force:lightning CLI commands.
Ex : force:lightning:app:create – Create lighting application
Ex : force:lightning:component:create – Create lighting component
Ex : force:lightning:event:create – Create lighting event
Ex : force:lightning:interface:create – Create lighting interface
7) force:org – Manage orgs which are used in salesforce CLI.
Ex : force:org:create – Create Scratch org or sandbox
Ex : force:org:delete – Delete Scratch org or sandbox
Ex : force:org:clone – Clone sandbox
Ex : force:org:list – Lists all orgs created or authenticated using Salesforce CLI.
Ex : force:org:open – Opens an org in your browser.
Ex : force:org:status – If the org is ready, authenticates to the org.
We have so many commands in salesforce to perform operations on user, Visualforce, packages etc.
