Bala Senthil
Bala Senthil

Reputation: 71

How to find Jenkins version through CLI command? Is there any command like "java - version"

Find Jenkins version in CLI Command.

I can tell there are 3 ways to do it.

  1. Open config file from the installation directory

    cd /var/lib/Jenkins/
    

    Open config.xml file, to see the version.

  2. Available in bottom of Jenkins’s UI.

  3. grep "version>" /var/lib/jenkins/config.xml
    

This is the way!

 java -jar /usr/share/jenkins/jenkins.war --version

Upvotes: 6

Views: 34163

Answers (3)

Bala kumar
Bala kumar

Reputation: 25

To check the version, use the below command

brew info jenkins-lts

To reach the installed location, If you are installed with brew, you can try this commands.

  1. brew list - list all brew installed formulae
  2. brew --prefix jenkins-lts - Gives you the installed directory [ex: /opt/homebrew/opt/jenkins-lts]
  3. cd /opt/homebrew/opt/jenkins-lts - Navigate to the directory

Upvotes: 1

skg
skg

Reputation: 191

Locate jenkins.war [1] and run it with java -jar adding --version switch, thus:

    $ java -jar /path/to/jenkins/jenkins.war --version

where:

path/to/jenkins is your location of jenkins.war, which can be as follows (depending on your linux distro):

  • /usr/lib/jenkins
  • /usr/share/jenkins
  • ..

[1] bonus - how to locate Jenkins JAR:

$ cd / && find | grep "jenkins/jenkins.war"

Upvotes: 6

Samwar
Samwar

Reputation: 143

Yes, to get the current version of jenkins you can execute

jenkins --version

The jenkins executable in /usr/bin is a shell script that determines where the jenkins war is located, and then runs commands against it.

$ jenkins --help
Running from: /usr/share/java/jenkins.war
webroot: $user.home/.jenkins
Jenkins Automation Server Engine 2.332.2
Usage: java -jar jenkins.war [--option=value] [--option=value]
...
a bunch of options to pass to the war file

Upvotes: 1

Related Questions