I study the magnetic field generated by the magnetized rocky part of terrestrial bodies. For this, I use spacecraft and near-surface magnetic field measurements, and I conduct laboratory measurements on magnetized samples. The amazing property of rocks to acquire and retain magnetization makes this magnetic field signal a precious window into the present and past state of terrestrial planets.