This article will describe virus scan with ClamAV.
Table of Contents
1 Virus scan with clamav
Install clamav.
$ sudo apk add clamav
The clamscan command will scan file or directory.
- -r option will scan directory recursively.
- -i option will show detected file only.
- –move option will move detected file to specific directory.
$ mkdir ~/virus $ clamscan -r -i --move=$HOME/virus .
2 Update virus database with freshclam
The freshclam command will update virus database.
$ sudo freshclam
freshclam can be done automatically. You can change freshclam interval with Checks value in /etc/clamav/freshclam.conf (Default value is 12).
$ sudo rc-update add freshclam $ sudo rc-service freshclam start
3 Virus scan with clamd
clamd daemon load database once and wait as a daemon. And run virus scan by request from clamdscan command without loading database.
clamd daemon always consume memory for database, but clamdscan is faster than clamscan. And clamdscan's behavior depends on clamd while clamscan's behavior depends clamscan's options.
$ sudo rc-update add clamd $ sudo rc-service clamd start $ clamdscan <dir>