Relative out of plane displacements of the constituent layers of two dimensional materials gives rise to unique low frequency breathing modes. By computing the height-height correlation functions in momentum space, we show that, the layer breathing modes (LBMs) can be mapped consistently to vibrations of a simple linear chain model. Our calculated thickness dependence of LBM frequencies for few layer (FL) graphene and molybdenum disulphide (MoS$_{2}$) are in excellent agreement with available experiments. Our results show a redshift of LBM frequency with increase in temperature, which is a direct consequence of anharmonicities present in the interlayer interaction. We also predict the thickness and temperature dependence of LBM frequencies for FL hexagonal boron nitride (hBN). Our study provides a simple and efficient way to probe the interlayer interaction for layered materials and their heterostructures, with the inclusion of anharmonic effects.