Actually Linux is a UNIX based Operating System and more over it is Open Source.
It is a myth that LINUX is Virus free ! Linux is also attacked by virus and other worms,rootkits etc
Due to low market share of LINUX ,they are not widespread .Hackers dont develop such viruses to attack small group of users.
There were initial release of MAC Os stating that they were virus free but ultimately they removed that label from its product.