Using the CLI Tools

The `ballerina` command is your one-stop-shop for all the things you do in Ballerina.

Using the ‘ballerina’ Command

In the CLI, execute the ballerina help command to view all the actions you can perform with it as shown below.

CLI commands

You can use the ballerina command in the below format.

ballerina <THE-COMMAND> <ITS-ARGUEMENTS>

Tip: You can view details of any of the commands below by executing ballerina help <COMMAND>. For example, the below is the output of the ballerina help pull command.

Ballerina help output

Core Commands

These everyday commands are your best friends! They address the very basics of programming in Ballerina such as compiling, running, testing programs, and generating their documentation.

build Compile a Ballerina program, a single BAL file, an entire project, or a single root module into an executable JAR file.
run Build and run a Ballerina program, a single BAL file, a module, an entire project, or a previously-built program. For more information, see Running Ballerina Code.
test Run tests of a particular module or all the modules of a Ballerina project. For more information, see Testing Ballerina Code.
doc Generate API documents for all public symbols of a Ballerina module or project. For more information, see Documenting Ballerina Code.
clean Clean all artifacts generated by the build command for a project.
format Format Ballerina source files as per the Coding Conventions.

Module Commands

These commands allow you to work with the Ballerina Central to share Ballerina modules with others in a safe, secure, and dependable way.

pull Pull a module from Ballerina Central.
push Upload a module to Ballerina Central. For more information, see Publishing Modules to Ballerina Central.
search Search Ballerina Central for modules.

Project Commands

Ballerina projects are the way to organize real world Ballerina development tasks.

new Create a Ballerina project. For more information, see Structuring Ballerina Code.
add Create a new Ballerina module in a project. For more information, see Structuring Ballerina Code.

Other Commands

These powerful supporting tools extend Ballerina to various ecosystem technologies that are inherently cloud-native. This functionality will grow over time and will even be developer extensible in the future.

encrypt Use this tool to encrypt sensitive data and pass them to a Ballerina program via the configuration system.
grpc This is the gRPC stub/skeleton generation tool. For more information, see Generating Ballerina Code for Protocol Buffer Definitions.
openapi This is the OpenAPI (Swagger) stub/skeleton generation tool. For more information, see Using the OpenAPI Tools.
version Tells you the version of the distribution you are currently using, the language specification version on which it is based, and the update tool version, which is currently in use.
bindgen Use this tool for auto-generating Ballerina bridge code for Java APIs. For more information, see Calling Java Code from Ballerina.
help Prints the usage details of any Ballerina command (e.g., `ballerina help pull`).

Update Commands

dist Manage Ballerina distributions. For more information, see Keeping Ballerina Up to Date.
update Update the Ballerina tool. For more information, see Keeping Ballerina Up to Date.