What Is a Computer Virus
A computer virus is a type of malware — malicious software written on purpose to do harm — and specifically the kind that copies itself into other programs or files so it can spread, much the way a biological virus hijacks healthy cells to make more of itself. Because, as the how-programs-run topic explained, a program is just instructions the computer will faithfully execute, a virus is nothing magical: it is a program whose instructions happen to be harmful, and the whole problem is getting the computer to run it in the first place. "Malware" is the umbrella term, and a virus is only one member of a family worth telling apart: a true virus attaches itself to a legitimate program and runs when you run that program; a worm is similar but spreads on its own across the networks from the internet topic without needing you to open anything; a trojan disguises itself as something useful or harmless so that you choose to run it yourself; ransomware encrypts your files — using the same kind of encryption the staying-safe-online topic described, but turned against you — and demands payment for the key; and spyware quietly hides and collects your passwords, messages, or banking details. What they share is a goal that is harmful to you and helpful to an attacker, and a need to get executed on your machine. That need is exactly why most infections start with a person being tricked rather than a computer being out-engineered: opening an email attachment that is really a program, downloading "free" software from an untrustworthy site, clicking a fake update, or plugging in an unknown USB drive. Once running, malware does whatever its instructions say — delete or scramble files, steal data, show ads, or quietly turn your machine into one more remotely controlled computer in a botnet used to attack others. The defenses follow directly from how malware spreads and are the same habits the staying-safe-online topic set out: keep your operating system and applications updated so known holes are patched, be skeptical about what you open, download, and run, and use antivirus software, which works mainly by recognizing known-bad programs and watching for suspicious behavior. The honest mental model is reassuring rather than frightening: a virus is a harmful program that still has to be run to do anything, so the single most effective protection is simply being careful about what you allow your computer to execute — the earlier topics already taught that the computer will run whatever instructions it is given, and avoiding malware is mostly about making sure those instructions were ones you actually chose to trust.