Mainshock
In seismology, the mainshock is the largest earthquake in a sequence, sometimes preceded by one or more foreshocks, and almost always followed by many aftershocks.

Foreshock

A foreshock is an earthquake that occurs before a larger seismic event (the mainshock) and is related to it in both time and space. The designation of an earthquake as foreshock, mainshock or aftershock is only possible after the full sequence of events has happened.

Aftershock 

In seismology, an aftershock is a smaller earthquake that follows a larger earthquake, in the same area of the main shock, caused as the displaced crust adjusts to the effects of the main shock. Large earthquakes can have hundreds to thousands of instrumentally detectable aftershocks, which steadily decrease in magnitude and frequency according to known laws. In some earthquakes the main rupture happens in two or more steps, resulting in multiple main shocks. These are known as doublet earthquakes, and in general can be distinguished from aftershocks in having similar magnitudes and nearly identical seismic waveforms.

References

Seismology
Types of earthquake