We know that, a freely suspended magnetic needle always points in North-South direction due to earths magnetic field. If a freely suspended magnetic needle always rests in North-South direction, then the magnetic field is due to earth, and if this magnetic needle turns to some other direction and returns back to North-South direction when the current is switched OFF, then the magnetic field is due to a current carrying conductor.