The .jenkins is the main directory that contains all the details for Jenkins installation files, configurations, plugins, build job configuration, and so on.
Configuring JENKINS_HOME
Getting ready
It is important to keep the .jenkins directory at a location where a good amount of free space is available. By default, Jenkins creates .jenkins (or JENKINS_HOME) at a specific location considering the operating systems.
For example, in Windows it is available at C:\Users\<USER_NAME>\.jenkins.
How to do it...
- In Windows, to change to JENKINS_HOME, go to the Control Panel | All Control Panel Items | System.
- Click on Advanced System Settings.
- Click on Environment Variables.
- Create a new variable JENKINS_HOME and give the path:

- In Ubuntu, go to /etc/default/Jenkins.
- Change the JENKINS_HOME location:

- Once changes are done, save the changes.
How it works...
Once JENKINS_HOME is changed, you need to restart Jenkins. The next time Jenkins starts, it will take JENKINS_HOME as the location that you have configured.
There's more...
The following table describes the default location of JENKINS_HOME in different operating systems:
Operating system |
$JENKINS_HOME location |
Windows |
C:\Program Files (x86)\jenkins or C:\Users\<USER>\.jenkins |
Mac OSX |
Macintosh HD/Users/Shared/Jenkins |
Ubuntu/Debian |
/var/lib/jenkins |
Red Hat/CentOS/Fedora |
/var/lib/jenkins |
OpenSUSE |
/var/lib/jenkins |
FreeBSD |
/usr/local/etc/jenkins |
OpenBSD |
/usr/local/etc/jenkins |