The DFINITY command-line execution environment (
dfx) is the primary tool for creating, deploying, and managing the dapps you develop for the IC.
dfx parent command with flags and subcommands to specify the operations you want to perform with or without optional arguments.
dfx [subcommand] [flag]
You can use the following optional flags with the
dfx parent command or with any of the
|Displays usage information.|
|Suppresses informational messages.|
|Displays detailed information about operations.|
|Displays version information.|
You can use the following options with the
|Specifies the user identity to use when running a command.|
|Writes log file messages to the specified log file name if you use the |
|Specifies the logging mode to use. + You can set the log mode to one of the following:|
The default logging mode is stderr.
Use the following subcommands to specify the operation you want to perform or to view usage information for a specific command.
For reference information and examples, select an appropriate subcommand.
|Builds canister output from the source code in your project.|
|Manages the |
|Manages deployed canisters .|
|Deploys all or a specific canister from the code in your project. By default, all canisters are deployed.|
|Displays usage information for a specified subcommand.|
|Enables you to create and manage the identities used to communicate with the IC.|
|Enables you to interact with accounts in the ledger canister running on the Internet Computer.|
|Creates a new project.|
|Sends a response request to the IC or the local canister execution environment to determine network connectivity. If the connection is successful, a status reply is returned.|
|Starts a local canister execution environment.|
|Prints the schema for |
|Starts the local canister execution environment a web server for the current project.|
|Stops the local canister execution environment.|
|Upgrades the version of |
|Enables you to manage cycles, controllers, custodians, and addresses for the default cycles wallet associated with the currently-selected identity.|
You can use the
dfx parent command to display usage information or version information. For example, to display information about the version of
dfx you currently have installed, you can run the following command:
To view usage information for a specific subcommand, specify the subcommand and the
--help flag. For example, to see usage information for
dfx build, you can run the following command:
dfx build --help
Using logging options
You can use the
--quiet flags to increment or decrement the logging level. If you don’t specify any logging level, CRITICAL, ERROR, WARNING, and INFO messages are logged by default. Specifying one verbose flag (
-v) increases the log level to include DEBUG messages. Specifying two verbose flags (
-vv)increases the logging level to include both DEBUG and TRACE messages.
--quiet flag decreases the logging level. For example, to remove all messages, you can run a command similar the following:
dfx build -qqqq
Keep in mind that using TRACE level logging (
--vv) generates a lot of log messages that can affect performance and should only be used when required for troubleshooting or analysis.
To output log messages to a file named
newlog.txt and display the messages on your terminal when creating a new project, you can run a command similar to the following:
dfx new hello_world --log tee --logfile newlog.txt
Specifying a user identity
If you create user identities with the
dfx identity new command, you can then use the
--identity comment-line option to change the user context when running other
In the most common use case, you use the
--identity option to call specific canister functions to test access controls for specific operations.
For example, you might want to test whether the
devops user identity can call the
modify_profile function for the
accounts canister by running the following command:
dfx canister call accounts modify_profile '("Kris Smith")' --identity devops