What is the difference between a Virus and Spyware?
The difference is in how the code affects you.
The generic term for malicious software is malware. As viruses came about first, many people will use the word "virus" as the generic term. Thus you have to take a look at how the malware operates, hides, and spreads to put a more accurate term to it. Additionally, it's not always clear which category a piece of malware falls into. This is more than most people care to think about, and it's not very practical as anti-virus software cleans them off without making a large deal about the differences. The most practical use of the distinction is to know what your anti-virus and/or anti-spyware software protects you against.
Some specific types of malware:
- Virus - attaches to files; multiplies on your computer and eats up resources
- Rootkit - hides on your computer and may require special anti-rootkit software
- Spyware - logs computer events
- Trojan - masquerades as something else to get you to install it, may allow someone else to control your computer
- Worms - spreads over networks, may damage your computer by doing things like deleting files
- Adware - more annoying than malicious, it serves ads
Both fall under the more general term malware, meaning bad. There is also a third term, adware, which is often thrown in with spyware.
Spyware is designed to do just that: Record what you do on your computer, but also to track your Internet browsing habits, since that can be valuable. This is why it is often lumped in with adware.
Adware is just that: Serves up ads, usually by multiple browser pop-ups, and re-direction.
Viruses generally do more damage, and have some specific goal in mind, like turning your computer into a spam-bot, or make it part of a bot-net. It often tries to replicate itself through various means to other computers. To expound on what someone else said, rootkits, trojans, and worms are specific types of viruses. Rootkits are named for where they hide, trojans for how they are delivered (think trojan horse), and worms also how they are delivered (they worm their way, often automatically, in through vulnerabilities in your system, so keep it patched.