First thing i would like to tell that no operating system is 100 percent secure and would not be affected by any of the malware attack. But Linux is more secure than any other operating system because of its features
1. Windows by default gives access to the core of administrative rights where the virus can penetrate to core of the operating system while Linux gives lower access rights,so virus can attack only local files and the replica of local files will be already there in system administration
2. Windows architecture is not divided so virus could eventually reach many of the systems which harm their users,but in case of Linux as it have many of the distros like ubuntu, RedHat,etc and features like email clients,environment console,system packages make the system more secure
3. IPtables are used in Linux to enhance security circle of the system.for execution of any command or to access the internet this firewall allows you to build more secure environment.