A computer virus is a type of malware that attaches itself to other programs and replicates itself by modifying those programs. Once the virus has infected a computer, it can spread to other computers through various means such as email attachments, file-sharing programs, or infected code repositories. Computer viruses can infect a variety of different subsystems on their host computers and software, including binary executables, data files, or the boot sector of the hosts hard drive.
Some common activities that viruses perform on infected host computers include acquiring hard disk space or central processing unit (CPU) time, accessing and stealing private information, corrupting data, and displaying political, humorous, or threatening messages on the users screen. Unlike worms, viruses often require some sort of user action, such as opening an email attachment or visiting a malicious web page, to spread.
It is important to note that a virus is just one type of malware, and the definition of a virus is that it’s a computer program that can self-replicate, infect other programs, and spread to other computers.