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:
Change to the directory containing the
In your favorite text editor, copy and paste the following into a new "alias" file:
#!/bin/sh java -jar jenkins-cli.jar -auth username:password -s http://operations-center-url:port-number/ "$@"
port-numbervalues as required.
Save the alias file with an appropriate file name (such as
This alias file assumes that
jenkins-cli.jaris located in the same directory.
Make the alias file executable using the following command.
chmod a+x jenkins-cli.sh
Configure the actual alias to your alias file in your appropriate Bash configuration file (
.bashrc), which is usually located in your home directory.
For example, in your favorite text editor, copy and paste the following line into
/path/tovalue as required and save the configuration file.
Reload your Bash configuration by entering the appropriate command (based on the file you edited).
For example, enter the appropriate command:
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:
Retrieving the version of your Operations Center instance:
Obtaining more information about a specific Jenkins CLI command:
jenkins-cli help plugin-catalog