We know what Earth's past climate was like by studying things that have been around for a long time. For example, scientists can study what Earth's climate was like hundreds of years ago by studying the insides of trees that have been alive since then.
But if scientists want to know what Earth's climate was like hundreds of thousands to millions of years ago, they study sediment cores and ice cores. Sediment cores come from the bottoms of lakes or the ocean floor. Ice cores are drilled from deep — sometimes miles — below the surface of the ice in places like Antarctica.
A drilled ice core kind of looks like what you get if you plunge a drinking straw into a slushy drink and pull it out with your finger over the end of the straw.
The layers in an ice core are frozen solid. These layers of ice give clues about every year of Earth's history back to the time the deepest layer was formed. The ice contains bubbles of the air from each year. Scientists analyze the bubbles in each layer to see how much CO2 they contain.
Ice Core sample taken from drill.
Scientists can also use ice cores to learn about the temperatures for each year. As snow accumulates onto a growing glacier, the temperature of the air imprints onto the water molecules in the ice.
Scientists who use trees, ice cores, and lake and ocean sediment to study Earth's climate are called paleoclimatologists. They look at all of these sources of information and compare their findings to see if they match up. If they do, then their findings are accepted as being most likely true. If the findings don't agree, the scientists do more studies and collect more information.
In the case of Earth's climate history, the results from many different kinds of studies agree.