In Jenkins, we can change the port on which Jenkins service is running in any operating system via commands.
Use the following command at command prompt in Windows or Terminal in Linux: java -jar jenkins.war –httpPort=9999
For https Use the following command at command prompt in Windows or Terminal in Linux: java -jar jenkins.war –httpsPort=8888
However, it can be a solution if default port is already occupied. In such case when you try to run Jenkins it will give following error:
java.net.BindException: Address already in use: bind
In such case also if you want a quick solution then just change a default port on which Jenkins runs.