Do’s and don’ts to avoid malware and spyware

Hello friends,
I just want to know how virus, spyware and other Malware attack the computer. My brother always tells me that don’t just click links that I am not familiar with because it might have harmful contents that will make the computer at risk. So, I want to know all possible ways on how a virus can get on a computer, so that I can become aware of it.
Thanks in advance.
