system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5:How does Antivirus work?
gpt
I expect others will chime in with more detailed answers but for an ELI5 it works in a few ways.


Firstly it scans for programs people have identified as viruses/malware.  A virus may be a file on your computer or it may be just a part of a file on your computer the virus has modified.  These are scanned everytime a file is opened from the hard disk.  Because a new virus may be found and added to the database your computer also needs to be scanned periodically to make sure nothing slipped through the net.


Secondly it detects suspicious behaviour.  For instance one program editing an existing program on your machine is rather dodgy.  There are a few applications that would do this (think AppStore or Updates) so if you exclude those anything else attempting to do that is likely dodgy.


In order for virus scanners to detect viruses it needs to make sure it gets priority over everything else which is why they usually get a bad rep as this low level tinkering/invasive scanning slows machines down and can do rather annoying thing like giving false warnings.