Configuring an alias for the Jenkins CLI tool


If you use the Jenkins CLI tool regularly, configure an alias to avoid having to type the entire command each time.

For instance, assuming you’re using Bash:

  1. Change to the directory containing the jenkins-cli.jar file.

  2. In your favorite text editor, copy and paste the following into a new "alias" file:

    java -jar jenkins-cli.jar -auth username:password -s http://operations-center-url:port-number/ "$@"
  3. Adjust the username, password, operations-center-url, and port-number values as required.

  4. Save the alias file with an appropriate file name (such as

    This alias file assumes that jenkins-cli.jar is located in the same directory.
  5. Make the alias file executable using the following command.

     chmod a+x
  6. Configure the actual alias to your alias file in your appropriate Bash configuration file (.bash_profile or .bashrc), which is usually located in your home directory.

    For example, in your favorite text editor, copy and paste the following line into .bash_profile or .bashrc:

    alias jenkins-cli='/path/to/'
  7. Edit the /path/to value as required and save the configuration file.

  8. Reload your Bash configuration by entering the appropriate command (based on the file you edited).

    For example, enter the appropriate command:

    • source ~/.bash_profile


    • source ~/.bashrc

Now, the command jenkins-cli will replace:

java -jar jenkins-cli.jar -auth username:password -s http://operations-center-url:port-number/

Therefore, using this alias, the commands in the examples of usage section could be simplified to the following:

  • Listing all available Jenkins CLI tool commands:

    jenkins-cli help
  • Retrieving the version of your operations center instance:

    jenkins-cli version
  • Obtaining more information about a specific Jenkins CLI command:

    jenkins-cli help plugin-catalog