How do I create a new wallet using command lines?

Using dfx, you can create a new wallet by creating a new canister that your wallet can be deployed into. 

 

You can create an empty canister for your wallet:

%  dfx ledger --network ic create-canister $(dfx identity get-principal)
--
amount 0.25
Transfer sent at BlockHeight: 3342056
Canister created with id: "ttk2q-5yaaa-aaaap-qadba-caa"

 

After the canister is created, you need to deploy your wallet into the canister. ttk2q-5yaaa-aaaap-qadba-caa is the id of the canister that was received in the previous step.

%  dfx identity --network=ic deploy-wallet ttk2q-5yaaa-aaaap-qadba-caa
Creating a wallet canister on the ic network.
The wallet canister on the "ic" network for user "old_identity" is "ttk2q-5yaaa-aaaap-qadba-caa"

 

Now you can check the balance of the new wallet:

% dfx wallet --network=ic balance
3024789141281 cycles.

 

The current wallet setting is stored in your file system in the folder ~/.config/dfx/identity/<identity_name>/wallets.json. The file should look something like the following:

{
	"identities": {
		"old_identity": {
			"ic": "ttk2q-5yaaa-aaaap-qadba-caa"
		}
	}
}

 

Updated