Dinosaurs evolved about 230 million years ago, splitting from their archosaur cousins in the early Triassic, 21 million years after the catastrophic Permian-Triassic extinction, which wiped out most life on Earth. Like other archosaurs, dinosaurs are characterized by socket-teeth, which makes them less likely to be pulled loose during feeding, distinctive holes in the skull, and a special ridge for attaching muscles on the femur.
Prior to the Permian-Triassic extinction, archosaurs were a relatively obscure group of reptiles. In the late Permian, the land was dominated by the therapsids, ancient relatives of mammals. Most therapsids didn't survive the end-Permian extinction very well, or the arid world which followed it. This left several major ecological niches wide open, which the archosaurs began to exploit. Many scientists believe that reason for the rise of archosaurs and dinosaurs had to do with better strategies to cope with arid environments. For instance, archosaurs can release uric acid — a byproduct of metabolism found in urine — as a paste rather than a liquid, conserving water. Lacking glandular skin would have also been an advantage.
What is thought to be the common ancestor of all dinosaurs, Eoraptor, a 1-meter tall bipedal predator, evolved about 230 million years ago. At one time it was thought that dinosaurs were a paraphyletic group, a group not consisting of a common ancestor and all its descendants, but most scientists have since come to the conclusion that all dinosaurs did descend from a common ancestor. Prior to the Carnian, about 215 million years ago, dinosaurs were relatively rare, only representing 1-2% of land faunas. At the Carnian boundary, however, many of the therapsids and other archosaurs that survived the end-Permian extinction finally went extinct, leaving everything wide open for the dinosaurs. Quickly, dinosaurs came to represent at least 50%, if not 90%, of all individual land fauna.
By the end of the Triassic, the Age of the Dinosaurs had begun. The two main types of dinosaurs, therapods and sauropods, diversified enough to occupy most of the major ecological niches. Over time, they became less primitive, with some groups, such as sauropods, getting progressively larger, until they weighed more than the blue whale of today. During most of the Mesozoic, every animal larger than a meter in size was a dinosaur of some kind.