why do only iron attracts magnet
The magnetic properties of a material are governed entirely by the magnetic moment or electron spin of the electrons in that material. In metals there are two types of electrons: bound electrons and free electrons. The free electrons are free to move between atoms. The bound electrons are stuck to the individual atoms.
Each electron, in addition to having charge, also has a “magnetic moment” or electron spin. Generally the bound electrons will be paired off in opposite spin pairs. They almost completely cancel each other out. However, sometimes (in iron, nickel, and cobalt for example) you’ll have one or more un-paired electrons. The magnetic fields of these electrons aren’t cancelled out by another, oppositely-oriented, electron. As these electrons align same way, results in a strong magnetic field.
When you bring a magnet close to iron ( or nickel, cobalt), the property of iron allows the spinning electrons in the iron to easily align with the magnetic field and hence attract to magnet. While other substances do not allow this alignment as easily as iron and hence does not get attracted to magnet.
Actually Magnets attract all objects, but Something that is strongly attracted to a magnet is said to have a high permeability. Iron and steel are two examples of materials with very high permeability, and they are strongly attracted to magnets. Liquid oxygen is an example of something with a low permeability, and it is only weakly attracted to a magnetic field. Water has such a low permeability that it is actually repelled by magnetic fields. Everything has a measurable permeability: people, gases and even the vacuum of outer space.PermeabilityIn electromagnetism, permeability is the degree of magnetization of a material that responds linearly to an applied magnetic field.