An electric current can cause a magnetic field. The field patterns due to different currents can be seen in the diagrams below.
The field pattern of a straight wire carrying current
The direction of the field lines can be remembered with the right-hand grip rule. If the thumb of the right hand is arranged to point along the direction of a current, the way the fingers of the right hand naturally curl will give the direction of the field lines.
Figure 1 shows the Magnetic field lines due to current in a straight wire & the use of the right-hand grip rule to find out the direction of the field lines.
Field pattern of a flat circular coil
Figure 2 below shows the Field pattern caused by a current flow in the direction shown through a flat circular coil.
The field pattern of solenoid
Figure 3 below shows the Field pattern of a solenoid. It is the same as that of a bar magnet. The poles of the solenoid can be predicted using the right-hand grip rule.