An earthquake gives no warning, so safety comes down to a trained reflex and some preparation done long before. Most injuries come not from the shaking itself but from falling objects and broken glass, so the whole aim is to protect yourself from what falls.