The U.S. Federal Emergency Management Agency and the American Red Cross both recommend using the duck and cover technique. With duck and cover, you should, if possible, get under a table or other solid piece of furniture and hold on until the shaking ceases. Other common tips include staying against an inside wall and not going near windows or outside until the shaking stops. As with a fire, elevators should be avoided.
Doorways can be secure areas, but not always. If a doorway is the closest safe option and you know that it's a structurally sound, load-bearing doorway, then go ahead and seek shelter under it. In any case, once you get to a safe place (which we hope is quickly), stay there, hold on tight and don't move until the shaking stops.
Earthquake advice changes depending on where you are when the disaster strikes. If you're in bed, it might be best to stay there and use a pillow to protect your head and neck. Of course, if you haven't secured objects that could fall on your bed, then that's not a safe area.
If you're driving and it's possible to continue moving, drive slowly to a safe place, but don't stop on or under overpasses, bridges or other potentially unstable areas. Turn off the car, use its emergency flasher lights and keep the parking break engaged. As you would if you were outside your car, keep an eye out for objects that might fall, like power lines or trees.
If you're outside during an earthquake, it's best not to move too much. You should avoid buildings and objects or structures that could fall. Again, power lines are a concern, but so are a building's outside walls, which may not be as strong as interior walls. Avoid these exterior walls, as they can collapse or produce falling debris or flying glass.
Now that you've made it through the main event, let's find out what to do afterward.