Electromagnets:
Any electric current, or movement of charge carriers, generates a magnetic field. This field can become intense in a tightly coiled wire containing many turns and carrying a large electric current. Whenever a ferromagnetic rod, known as a core, is placed within the coil, the magnetic lines of flux are concentrated in the core and the field strength in and close to the core become tremendous. This is the principle of an electromagnet (the figure is as shown below).
Figure: A simple electromagnet.
Electromagnets are almost forever cylindrical in shape. At times the cylinder is thin and long; in other situation it is fat and short. Whatever the ratio of diameter to length for the core, though, the principle is always similar: The flux generated by the current temporarily magnetizes the core.