Prehistory spans from 2 million years ago to the invention of writing around 3,000 BC. It encompassed over 2 million years where humans lived as hunter-gatherers and began basic tool use and fire, while history refers to the last 5,000 years. The Paleolithic and Neolithic periods saw major changes - in Paleolithic times humans hunted and gathered wild plants, lived nomadically in caves, and used stone tools, whereas in Neolithic times humans domesticated animals and plants, lived sedentary lives in houses near rivers, and used stone and wood tools as well as pottery.