Manage Jenkins
from the command line.
Trigger builds, stream console logs, and manage jobs, nodes, plugins, credentials, pipelines, and views, all without leaving the terminal. First-class JSON output for scripts and agents.
01Install
Get the binary
Pick whichever fits your setup. The binary is jenkins. The install script handles platform detection and PATH setup.
Recommended, install script
curl -sSfL https://raw.githubusercontent.com/piyush-gambhir/jenkins-cli/main/install.sh | sh
Via Go
go install github.com/piyush-gambhir/jenkins-cli@latest
Build from source
git clone https://github.com/piyush-gambhir/jenkins-cli.git cd jenkins-cli go build -o jenkins . sudo mv jenkins /usr/local/bin/
From releases
Download a prebuilt binary for your platform from the
releases page
and place it on your PATH.
02Quick start
Authenticate once, then operate
Add -o json to any command for machine-readable output.
# 1. Authenticate (saves a profile to ~/.config/jenkins-cli/) jenkins login # 2. Show server status and confirm who you are jenkins status jenkins whoami # 3. List jobs, filter by status jenkins job list jenkins job list --recursive --status FAILURE # 4. Trigger a build (with optional parameters) jenkins build trigger my-pipeline jenkins build trigger my-pipeline --param ENV=staging --param VERSION=1.2.3 # 5. Stream console logs in real time jenkins build logs my-pipeline --latest --follow # 6. List nodes / build agents jenkins node list # 7. Pipe JSON to jq jenkins job list -o json | jq '.[].name'
03Authentication
Flexible credential management
CLI flags > environment variables > saved profile. Profiles are stored in ~/.config/jenkins-cli/.
interactiveDefault
Prompted setup, enter your Jenkins URL, username, and API token. Saved locally.
env varsCI / Agents
Set
JENKINS_URL, JENKINS_USERNAME, and JENKINS_TOKEN, no profile file needed.profilesMulti-server
Named profiles for multiple Jenkins servers. Switch with
jenkins config use-profile.Interactive login
jenkins login
jenkins login --name staging
Environment variables (CI / agents)
export JENKINS_URL=https://jenkins.example.com export JENKINS_USERNAME=admin export JENKINS_TOKEN=your-api-token
Multiple profiles
jenkins login # saves as default jenkins login --name staging # save a named profile jenkins config use-profile prod # switch active profile jenkins job list --profile staging # one-off override
04Commands
Broad coverage of the Jenkins API
Every group has its own --help. A selection of the top-level groups:
jenkins job
Create, list, get, configure, and delete jobs
jenkins build
Trigger, list, get, abort builds; stream console logs with
--followjenkins pipeline
Pipeline-aware build operations and stage inspection
jenkins node
Manage build agents: list, enable, disable
jenkins plugin
List, install, and update Jenkins plugins
jenkins credential
Inspect credential stores
jenkins view
Manage Jenkins views
jenkins folder
Manage folders and nested jobs
jenkins user
List and inspect users
jenkins config
View/set configuration, manage profiles
jenkins login
Interactive authentication setup
jenkins whoami · status · version · update
Identity, connectivity, CLI version, self-update
Common build operations
# Trigger a build with parameters jenkins build trigger my-pipeline --param ENV=staging --param VERSION=1.2.3 # List the last 10 builds for a job jenkins build list my-pipeline --limit 10 # Get the latest build's status jenkins build get my-pipeline --latest -o json # Stream logs for a specific build number jenkins build logs my-pipeline --build 42 --follow # Abort a running build jenkins build abort my-pipeline --latest
Output formats
jenkins job list # table (default) jenkins job list -o json # JSON jenkins job list -o yaml # YAML