Find the Best Cosmetic Hospitals

Explore trusted cosmetic hospitals and make a confident choice for your transformation.

“Invest in yourself — your confidence is always worth it.”

Explore Cosmetic Hospitals

Start your journey today — compare options in one place.

Jenkins CLI Guide: Download, Authenticate, and Automate Jobs from the Terminal

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.

Jenkins CLI

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 methodExampleBest for
Username and password flags--username me --password mypasswordQuick manual checks
SSH private key-i ~/.ssh/id_rsaReusable automation with key-based auth
Saved CLI credentiallogin and logout commandsReducing 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.

CommandWhat it doesTypical use
buildTriggers a job buildCI/CD automation from scripts
consoleGets build console outputTriage failed runs quickly
list-jobsLists jobs in a view or groupInventory and audit scripts
get-job / update-jobExports or updates job XMLBulk job maintenance
create-job / delete-jobCreates or removes jobsProvisioning and cleanup
list-plugins / install-pluginInspects or installs pluginsPlugin management
quiet-down, safe-restart, safe-shutdownControls server state safelyMaintenance windows
who-am-iShows identity and permissionsAuth 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

Best practices

  • Always download jenkins-cli.jar from the same Jenkins server you are targeting.
  • Prefer key-based authentication for automation and avoid hard-coding credentials in scripts.
  • Use help on 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.

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
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.

Related Posts

Automating Jenkins Job Configuration: Job DSL, Multibranch, Job Generator, and JJB

Manually creating many Jenkins jobs is slow and error-prone. This guide compares the main automation options and shows practical jobs-as-code examples for repeatable setup.

Read More

Install Jenkins with Docker: Persistent Setup, Port Mapping, and Logs

Learn how to run Jenkins in Docker with correct port mapping, persistent storage, and operational commands. This updated guide keeps the original workflow but adds modern, production-minded practices.

Read More

Jenkins at Scale: Practical References and Admin Cheatsheet

This revised guide upgrades a short 2015 Jenkins link post into an operations-ready reference for teams running Jenkins at scale. It preserves the original links and adds a workflow diagram, comparison table, and practical API/CLI examples.

Read More

Jenkins Backup and Restore Runbook: ThinBackup, Filesystem Archives, and Recovery Steps

A practical Jenkins backup and restore guide for DevOps teams, covering what to back up, strategy trade-offs, and step-by-step command examples. Includes a workflow diagram and a recovery checklist you can operationalize.

Read More
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
0
Would love your thoughts, please comment.x
()
x