A magnitude 5.0 earthquake rattled Southern California, triggering dozens of aftershocks and disrupting flights.