What do you do in an earthquake? If you are indoors the simple answer is, "DROP, COVER, HOLD ON." Specifically... DROP to the ground (before the earthquake drops you!),Take COVER by getting under a sturdy desk or table, and HOLD ON to it until the shaking stops.
The natural tendency is to want to run outdoors. However, the greatest danger in an earthquake is from falling objects. these can be items indoors like book shelves, ceiling fixtures, and other items. In an attempt to flee, one may be injured by such items. Additionally many injuries and deaths occur as the fascia of buildings crumble and fall on people attempting to exit a crumbling building.
Here is a more complete list of "what to do in an earthquake" that addresses several different scenarios that one might find themselves in when an earthquake strikes. This list is adapted from advice given by the Southern California Earthquake Center.
If you are...
Indoors: Drop, cover, and hold on. Drop to the floor, take cover under a sturdy desk or table, and hold on to it tightly. Hang on in this position until the shaking stops. If you are not near a desk or table, drop to the floor against an interior wall and protect your head and neck with your arms. Avoid exterior walls, windows, hanging objects, mirrors, tall furniture, large appliances, and kitchen cabinets with heavy objects or glass. Do not go outside!
In bed: If you are in bed, hold on and stay there, protecting your head with a pillow. You are less likely to be injured staying where you are. Broken glass on the floor can cause injury to those who have rolled to the floor or tried to get to doorways to escape.
In a high-rise: Drop, cover, and hold on. Avoid windows and other hazards. Do not use elevators.
Outdoors: Carefully move to a clear area if you can safely do so; avoid power lines, trees, signs, buildings, vehicles, and other hazards. Essentially, get away from things that may fall on you.
Driving: Pull over to the side of the road, stop, and set the parking brake. Avoid overpasses, bridges, power lines, signs and other hazards. Stay inside the vehicle until the shaking stops. If a power line falls on the car, stay inside until a trained person removes the wire.
Near the shore: Drop, cover and hold on until the shaking stops. Estimate how long the shaking lasts. If severe shaking lasts 20 seconds or more, immediately evacuate to high ground as a tsunami might have been generated by the earthquake. Move inland 3 kilometers (2 miles) or to land that is at least 30 meters (100 feet) above sea level immediately. Don't wait for officials to issue a warning. Walk quickly, rather than drive, to avoid traffic, debris and other hazards.
Below a dam: Dams can fail during a major earthquake. Catastrophic failure is unlikely, but if you live downstream from a dam, you should know flood-zone information and have prepared an evacuation plan. Be prepared to evacuate.
In many scenarios you may need to evacuate after the initial quake is over. This may be true if your home or office is no longer safe, if there is a threat of a tsunami, or if there are other hazards (e.g. the risk of a dam collapse) Be prepared to evacuate and be self-sufficient by having an earthquake kit that will support you and your family for at least 72 hours.