A seismograph is an instrument that measures and records the details of an earthquake such as its duration, force, and direction. The seismograph has a pen attached to it.
When an earthquake occurs, the pen also vibrates along with the vibrations produced by the earthquake.
The pen records the movements of vibrations on a moving strip of paper. Various waves which are formed by the moving pen give us an estimate of the direction and force of an earthquake. It also calculates the difference in the arrival of P and S waves.
Also, Read Movements of Ocean Waters