UPDATE: with current dfx, the cycles are automatically returned to the wallet.
This is a summary of the commands and their printed output:
$ dfx --version
dfx 0.8.4
# First stop the canister you want to delete
$ dfx canister --network ic stop <CANISTER_ID>
Stopping code for canister ...
# Now you can delete it
$ dfx canister --network ic delete <CANISTER_ID>
Beginning withdrawl of XXX cycles to canister ...
Setting the controller to identity princpal.
Installing temporary wallet in canister ... to enable transfer of cycles.
Transfering XXX cycles to canister ....
Deleting code for canister ...