Once we create the Scratch Org using the sfdx command, for example the below, we will get the org id and the username.
Sample sfdx command to create Scratch org:
sfdx force:org:create -f project-scratch-def.json --nonamespace
Successfully created scratch org: 00DXXXXXXXXXXXXXXX, username: [email protected]
We can use sfdx force:org:open -u command to open the Scratch org.
sfdx force:org:open -u [email protected]