Do what the people around you do or ask you to do!
Most of the time, there is nothing to do.
When there is an earthquake that feels longer, stronger than normal, you can switch the radio on and listen to the information that they will give. You can also rely on internet meteo data to know where it did happen, if there is any risk of tsunami (if you are close to such an area).
My recommendation is to check around you and do what the Japanese do because they receive drill exercices and know how to behave.
Do not panik, it will not change your fate. Try to protect yourself and your children. A table will do it.
If you live in Japan, I recommend that you keep a survival kit home and at the office. You can find lists of items on the internet, At the office, you might want to include things like sport shoes, besides the usual water bottle and soya stick.
I did not find a list in English but this emergency kit should at least have:
- drinkable water for 3 days per person
- some food for 3 days per person
- emergency kit like the one you have in your car + medicine for diarrhea, painkillers, thermometer, security pins, mask, aseptic fluid, wet tissues, etc.
- useful tools such as knife, forks, openers, plates and bowl, large scotch, a lamp, some batteries, paper and markers, protection gloves,
- toiletries and some basic clothe changes.
- towels, warm clothes, sports shoes, raincoat, protection against the sun,
- make sure that you have your passeport, important documents and some moneys in a place easy to get.
- a radio
- pet foods and drink if you have a pet
It is also good to make sure that your furniture is fixed to walls to that it does not fall down on you.