The data export command allows exporting a dataset from a scratch Org into JSON files.
Let's try to export the dataset to the data folder in your local project from one of the Dev Orgs. Note that you will need to connect your CLI with the Org you are trying to export data into using the auth commands we discussed in the previous section.
Let's try and run the following command:
sfdx force:data:tree:export -p -q "SELECT Id, Name, (SELECT Id, LastName, FirstName FROM Contacts) FROM Account" -u MyTPO --outputdir./data
Note that, here, -u is followed by the Org alias. It can be a username as well of the Org. In this case, I have an Org with the alias MyTPO.
-p indicates that multiple subject files should be generated, ...