There have been attacks on Linux over the years, of course, but for a number of reasons they typically don't have much of an effect.
Even better, though, is that Linux is so diverse, so users aren't all on a single, common operating system--instead, they're on many, many distinct distributions. That makes it much harder for a malware creator to find a worthwhile segment to target.
Strength in Numbers
Privileges are also typically assigned much more cautiously in Linux, but perhaps even more significant is the openness of the operating system's code. Where Mac users are totally dependent on Apple to recognize and act upon the problems that come up--it's notorious for dragging its feet on things like this--Linux users have the power to find, flag, and even start working on issues themselves.
I've said it before and I'll say it again: No single company can protect you as well as the worldwide community of users and developers can.
In short, Macs may have their advantages for a segment of users out there, but Linux is better on more than a few key features. Now more than ever, security is one of them.