Solved: How to start or stop Jenkins in Linux and check it’s port number

In this post we will see how to start or stop Jenkins on different Linux distributions. Also we will see how to check the status of Jenkins service and identify the port on which it is running or listening.

If you have installed Jenkins on a Fedora or Debian based distribution like Ubuntu, you can use the below commands:

Start Jenkins

$ sudo service jenkins start

Stop Jenkins

$ sudo service jenkins stop

Restart Jenkins

$ sudo service jenkins restart

Check Jenkins status

$ sudo service jenkins status

For other Linux distribution like RHEL or CentOS use:

 

Start Jenkins

$ sudo systemctl start jenkins.service

Stop Jenkins

Udemy

$ sudo systemctl stop jenkins.service

Restart Jenkins

$ sudo systemctl restart jenkins.service

Check Jenkins status

$ sudo systemctl status jenkins.service

Check Jenkins Port

To check the port on which Jenkins is listening we can use “lsof”(check installation instructions at the end) command.

[ec2-user@cloudvedas ~]$ sudo /usr/sbin/lsof -i -P | grep -i jenkins
java 1030 jenkins 161u IPv6 27986 0t0 TCP *:8080 (LISTEN)

Above we can see Jenkins is listening on port 8080.

If you do not have lsof you can simply install it with following commands

Ubuntu

sudo apt-get install lsof

RHEL or CentOS

sudo yum install lsof

 

Leave a Reply

Your email address will not be published. Required fields are marked *