Setting a default Dev Hub for scratch Org creation

To configure the default Dev Hub globally, execute the following command:

sfdx force:config:set defaultdevhubusername=mohith@dx.com -g  //use your developer hub username instead of mohith@dx.com

Here, -g denotes global and hence, by default, for all the DX projects, the same Dev Hub username will be used to create a scratch Org for other DX projects.

If you want to set a different Dev Hub, then omit -g and execute the same command in your project directory. The following screenshot shows that the default Dev Hub username has been set: