Due to electric current a magnetic field is generated. So when a compass is placed next to an electric field, it shows deviations.
The compass shows the direction of the North. Therefore the direction of the magnetic field can be found. This is found using the right hand rule.