This article will describe virus scan with ClamAV.
Table of Contents
1 Install ClamAV
Install clamav.
$ sudo pacman -Sy --noconfirm clamav
2 Update virus database with freshclam manually
The freshclam will update virus database.
$ sudo freshclam
3 Update virus database with clamav-freshclam.service
clamav-freshclam.service will update virus database automatically. You do not need to run freshclam manually.
$ sudo systemctl enable clamav-freshclam.service $ sudo systemctl start clamav-freshclam.service
4 Virus scan with clamscan
The clamscan 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 .
5 Virus scan with clamdscan
The clamd load database once and wait as a daemon. And run virus scan by request from clamdscan without loading database.
clamd 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 systemctl enable clamav-daemon.service $ sudo systemctl start clamav-daemon.service $ clamdscan <dir>