Jenkins CLI lets you run Jenkins operations from a terminal, which is useful for automation scripts, repeatable admin tasks, and quick troubleshooting. This guide shows how to get the correct CLI JAR, authenticate against secured Jenkins, trigger parameterized builds, and work with high-value commands.
Originally published on 2014-02-10; fully revised and updated.

Get the matching jenkins-cli.jar from your Jenkins server
The safest way to get jenkins-cli.jar is from your own Jenkins instance so the CLI version matches the server. Open your Jenkins /cli page (for example, http://yourserver.com/cli) and download the JAR from the link it provides (typically under /jnlpJars/jenkins-cli.jar).
java -jar jenkins-cli.jar [-s JENKINS_URL] command [options...] [arguments...]Code language: CSS (css)
Run help and discover commands on your server
Command availability can vary by Jenkins version and installed plugins, so always query your own server.
java -jar jenkins-cli.jar -s http://yourserver.com help
java -jar jenkins-cli.jar -s http://yourserver.com help buildCode language: JavaScript (javascript)
You can also browse command documentation from http://yourserver.com/cli.
Authenticate to a secured Jenkins
The original guide shows two common approaches for secured Jenkins: pass username/password each time, or use an SSH private key with -i.
| Authentication method | Example | Best for |
|---|---|---|
| Username and password flags | --username me --password mypassword | Quick manual checks |
| SSH private key | -i ~/.ssh/id_rsa | Reusable automation with key-based auth |
| Saved CLI credential | login and logout commands | Reducing repeated credential flags in interactive usage |
java -jar jenkins-cli.jar -s http://myjenkins help --username me --password mypassword
java -jar jenkins-cli.jar -s http://myjenkins help -i ~/.ssh/id_rsaCode language: JavaScript (javascript)
Trigger parameterized builds from the CLI
For parameterized jobs, pass each build parameter with -p key=value.
java -jar jenkins-cli.jar -s http://myjenkins build 'Deploy XYZ App' -i ~/.ssh/id_rsa -s -v -p target_env=api.cloudfoundry.com -p branch=masterCode language: JavaScript (javascript)
Jenkins CLI workflow
flowchart TD
A[Open Jenkins cli endpoint] --> B[Download matching jenkins cli jar]
B --> C[Run help command]
C --> D{Server secured}
D -- yes --> E[Authenticate with user pass or ssh key]
D -- no --> F[Run command directly]
E --> G[Execute build or admin command]
F --> G
G --> H[Review output and build logs]
Commonly used Jenkins CLI commands
The original post listed many commands. The table below highlights practical commands teams use frequently.
| Command | What it does | Typical use |
|---|---|---|
build | Triggers a job build | CI/CD automation from scripts |
console | Gets build console output | Triage failed runs quickly |
list-jobs | Lists jobs in a view or group | Inventory and audit scripts |
get-job / update-job | Exports or updates job XML | Bulk job maintenance |
create-job / delete-job | Creates or removes jobs | Provisioning and cleanup |
list-plugins / install-plugin | Inspects or installs plugins | Plugin management |
quiet-down, safe-restart, safe-shutdown | Controls server state safely | Maintenance windows |
who-am-i | Shows identity and permissions | Auth and RBAC troubleshooting |
java -jar jenkins-cli.jar -s http://yourserver.com get-job my-job > my-job.xml
java -jar jenkins-cli.jar -s http://yourserver.com update-job my-job < my-job.xmlCode language: JavaScript (javascript)
Original references and further reading
- Jenkins CLI reference (legacy Jenkins wiki link from original post)
- Stack Overflow: Jenkins CLI authentication
- Stack Overflow: Jenkins CLI public key authentication
Best practices
- Always download
jenkins-cli.jarfrom the same Jenkins server you are targeting. - Prefer key-based authentication for automation and avoid hard-coding credentials in scripts.
- Use
helpon your server before scripting commands, because CLI capabilities can differ by version. - Use safe operations (
quiet-down,safe-restart,safe-shutdown) during maintenance to avoid interrupting active builds.
I’m Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms.
I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.
Find Trusted Cardiac Hospitals
Compare heart hospitals by city and services — all in one place.
Explore Hospitals