The magnetic field of the Earth looks like a dipole, the shape formed by iron filings around a bar magnet, although the Earth’s is rotated about the field’s axis to form a three-dimensional shape.
This extends to about 40,000 miles into space.
On the ground we use a compass in two dimensions. In space you can use a 3D “compass” to map out the Earth’s magnetic field, again giving an indication of north.
Beyond 40,000 miles into space, in the direction of the sun, we exit the Earth’s magnetosphere and pass into the solar wind, which also carries the sun’s magnetic field.
During undisturbed solar periods the sun’s field is shaped like a spiral, thanks to the sun’s rotation, in the same way that a hosepipe whirled over your head emits a spiral of water.
Magnetic field measurements are made by interplanetary spacecraft to understand how the sun’s magnetic field and solar wind interact with the Earth’s magnetic field.
For instance, auroral displays are generated by the solar and terrestrial magnetic fields interlinking to allow solar wind plasma to enter the atmosphere.
On the opposite side of the Earth from the sun, the Earth’s magnetic field is pulled into a long magnetic tail by its interaction with the solar wind, typically to 4 million miles or more. A compass in this geomagnetic tail would point along the tail, either towards or away from the Earth.
It is interesting to note that if we left the solar system beyond the “heliopause” where the solar wind ceases to have an effect and traveled into interstellar space, approximately 150 astronomical units from Earth, our compass would start to measure the galactic field.
Here, our magnetic field measurements might point towards the constellation Pyxis, appropriately better known as the Compass.