The thunder has been discussed scientific for centuries and this phenomenon can be defined as a muffled sound gases as it expands rapidly through the discharge channel of a lightning that can also be used to heat the gases of the atmosphere in and around visible channel.
When this phenomenon occurs, temperatures can rise to more than 10,000 degrees Celsius in microseconds, causing a violent pressure wave, composed of compression and shock waves, caused when lightning instantly heats the air through which it moves between the clouds or in the land surface.
Hot air increases in volume and expands at high speed, but when it is mixed with cold air, the temperature drops sharply and it contracts, the rapid expansion and contraction is responsible for generating the shock waves and is considered as the responsible for the noise of thunder, because the sound of thunderand light travels at the same speed as they move through the atmosphere and you can measure the space between one another to find out how many kilometers the lightning struck.
Lightning, although it does not seem like it, does not mean the same thing, they are meteorological phenomena consisting of electrical discharge generated inside a natural capacitor, obviously, the former are the ones that usually cause damage or more frequent losses in anthropic systems, so they represent a risk situation that deserves special interest from the perspective of civil protection.