One of the reason there are only about 730 viruses total (and only 40 of those are out in the wild, the others 690 or so are in labs for education purposes) is because most of the people who use Linux are themselves programmers and thus will examine the code before installing. The new users or general computer users will only install software from the repositories which is very secure.
In the past, Linux did have issues with I believe worms and rootkits until Linus Torvalds integrated the firewall which loads at runlevel 3. After that, it was much harder to attack a Linux machine.
Also writing a virus for Linux would be very complex, you will have to decide; what filesystem will you be attaching, What architecture e.g., x86, ppc, spark, &c.,? Will it be source, deb, RPM, &c.?
There was a hole in Linux recently : http://www.h-online.com/open/news/item/Hole-in-Linux-kernel-provides-root-rights-Update-1081317.html . Blackhats hack at Linux and then report the security hole to the Linux Community for it to be fixed. What is interesting about the article is that it failed to mention that it only affected the x86 architecture and had no effect on anything else e.g., spark, ppc, &c.
There are some other reasons, though I believe I explained the main ones.