jenkins
Manage Jenkins automation server
TLDR
Connect to jenkins CLI
Restart jenkins
Shutdown jenkins
Display help
Display version
SYNOPSIS
The most common command-line interaction with Jenkins is via its CLI tool:
java -jar jenkins-cli.jar -s JENKINS_URL [general-options] command [command-options] [arguments]
Example:
java -jar jenkins-cli.jar -s http://localhost:8080/ build my-job
PARAMETERS
General Jenkins CLI Options:
These options are used with the java -jar jenkins-cli.jar invocation before specifying a Jenkins CLI command.
-s URL
Specifies the URL of the Jenkins server to connect to. This is usually mandatory.
-i KEYFILE
Uses the specified private key file for authentication against the Jenkins server.
-auth USER:TOKEN
Provides username and API token for authentication. The API token can be generated from the user's Jenkins profile.
-webSocket
Connects to the Jenkins server using WebSocket protocol for communication.
-remoting PROTOCOL
Specifies the Remoting protocol version to use for communication (e.g., 4, 5).
help
Displays general help for the CLI or detailed help for a specific command if followed by the command name (e.g., help build).
Specific Jenkins CLI Commands (Examples):
Jenkins CLI offers numerous commands. Each command has its own specific options and arguments.
build JOB_NAME
Triggers a build for the specified job. Can include optional parameters via -p.
-s
(For build command) Waits for the build to complete before returning.
-p NAME=VALUE
(For build command) Adds a build parameter. Can be specified multiple times for multiple parameters.
list-jobs
Lists all available jobs on the Jenkins server.
restart
Restarts the Jenkins server (requires appropriate permissions).
safe-restart
Restarts Jenkins safely, waiting for current builds to finish.
who-am-i
Shows the details of the currently authenticated user.
DESCRIPTION
Jenkins is a leading open-source automation server widely used to automate parts of the software development process, including building, testing, and deploying applications.
While 'jenkins' is not a direct executable command like ls or grep found in /usr/bin, it refers to the server application itself, typically run as a daemon process on a Linux system. Users interact with Jenkins primarily through its web-based user interface, but it also offers a powerful Command Line Interface (CLI) tool for scriptable access to Jenkins functionality. On Linux, Jenkins is commonly installed as a system service, managed using tools like systemctl to start, stop, or check its status.
Its core function is to facilitate continuous integration and continuous delivery (CI/CD) pipelines, enabling developers to automate various tasks and ensure code quality and rapid delivery.
CAVEATS
The name 'jenkins' does not refer to a standalone executable command typically found in standard Linux PATH directories like /usr/bin. Instead, Jenkins is an application server managed as a service. Command-line interaction is primarily done via the Jenkins CLI tool (requiring java and jenkins-cli.jar) or by managing the Jenkins service with system utilities like systemctl (e.g., systemctl start jenkins). Direct execution of a command named jenkins is not common unless a custom script or alias is created.
SERVICE MANAGEMENT
On systemd-based Linux systems, the Jenkins server is managed as a background service. Common commands include sudo systemctl start jenkins, sudo systemctl stop jenkins, sudo systemctl restart jenkins, and sudo systemctl status jenkins to control its lifecycle.
WEB UI ACCESS
Jenkins' primary interface is its web application, typically accessible via http://localhost:8080 (or a configured port and hostname) after installation. Initial setup and most configuration and job management are performed through this web interface.
JENKINS CLI TOOL DOWNLOAD
The jenkins-cli.jar tool can usually be downloaded directly from your Jenkins server at http://JENKINS_URL/jnlpJars/jenkins-cli.jar. This ensures compatibility with your specific Jenkins version.
HISTORY
Jenkins originated as a fork of the Hudson project in 2011, following a dispute with Oracle concerning the Hudson project's governance. Developed by Kohsuke Kawaguchi, who initially created Hudson, Jenkins quickly gained traction due to its strong community support, extensive plugin ecosystem, and commitment to open-source principles.
It has since become a de-facto standard for CI/CD, evolving continuously with features like Pipeline as Code, declarative pipelines, and container support, establishing itself as a robust platform for automating software delivery.


