In a fire, you stop, drop and roll. In a quake, it's drop, cover and hold on.
Get low to the ground, take cover, preferably under something or in a doorway and then hold on until the shaking stops.
Stay away from glass, windows, anything that could fall like furniture or lighting fixtures.
If you're outside.. move away from buildings, streetlights and utility wires.
Now, if you happen to be driving, stop as quickly as safety permits and stay in the car! Don't stop near or under buildings, trees, overpasses or utility wires.