Drop, Cover, and Hold On - the most widely accepted general rule in case you are caught in a quake (source: Earthquake Country Alliance)
If you are in an area where potentially large or damaging earthquakes are a significant natural hazard, it is very important you know what to do in case a larger quake occurs.
1) What to do before an earthquake
Prepare yourself, your home and your family, get familiar with official resources on earthquake hazard in your area, and work out the most efficient emergency plan for your specific case; this typically includes identifying the safest areas in your home, escape routes, remove or fix loose items or furniture that could drop on you during shaking, have emergency food and water for several days, batteries, medicine, first-aid kits, mobile phone and emergency numbers ready in case access to vital infrastructure is lost during a quake;
2) What to do during the quake
Avoid panic! In most cases the recommendation is Drop, Cover, and Hold On
; this depends very much on your exact location during a quake. If you are on a beach, head to higher ground after the shaking stops as tsunamis can be generated by the quake.
3) What to do after the quake has hit
Asses damage around you, bring yourself to safety avoid damaged buildings or steep slopes, help others, provide first aid if needed, notify rescuers, avoid using mobile phone for not-essential use, expect aftershocks, listen to official advice.
Recommended further reading
One of the best resources on earthquake safety is the Earthquake Country Alliance
(ECA) based in California. It provides extensive resources about earthquake preparedness, advice and help in case you are affected by a quake. Please visit their site to learn more
or download the Recommended Earthquake Safety Actions PDF