Skip to main content
In this tutorial, you’ll learn how to download the Jenkins CLI, authenticate, and trigger jobs directly from your terminal. This approach helps automate deployments and integrate Jenkins into your CI/CD workflows.

1. Download the Jenkins CLI JAR

Navigate to Manage Jenkins → Jenkins CLI and copy the link to jenkins-cli.jar:
The image shows the "Manage Jenkins" page of a Jenkins server, displaying options for troubleshooting and tools such as "Manage Old Data," "Jenkins CLI," and "Script Console."
Replace http://139.84.159.194:8080/ with your own Jenkins URL if different.
On your Jenkins controller VM:
Verify the download:

2. Explore Available CLI Commands

List all CLI commands and options:
Check your current identity:
Attempting to list jobs without proper credentials results in:

3. Authenticate with Username and Password

Use -auth USER:SECRET to provide credentials. For example:
Confirm your authenticated identity:
Avoid embedding plaintext passwords in scripts. Use Jenkins API tokens or SSH key authentication for better security.

4. Build Command and Flags

The build command accepts several useful flags:

5. Triggering a Parameterized Job

To trigger parameterized-pipeline-job with a BRANCH_NAME parameter:

6. View Job Status in Jenkins UI

After running the CLI command, you can monitor the build status and trends in the Jenkins dashboard:
The image shows a Jenkins dashboard displaying the status of a parameterized pipeline job, with a test result trend graph and a detailed pipeline execution timeline.

7. Include Full Console Output

If you need detailed logs in your terminal, add the -v flag:

You can automate these steps in shell scripts or integrate them into your CI/CD pipelines. Beyond building jobs, the Jenkins CLI lets you manage views, plugins, credentials, and more.

Watch Video