ArchLinux 2018.10.01: Virus scan with ClamAV

This article will describe virus scan with ClamAV.

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>

6 Virus scan with clamtk

clamtk provides GUI window, This is useful for desktop user.

$ sudo pacman -Sy --noconfirm clamtk

clamtk is as the following. My environment needs double click to select item.

0001_ClamTk.png

Check "scan directories recursively" in Settings.

0002_ScanDirectoriesRecursively.png

Home directory can be scanned recursively by "Scan a directory".

0003_ScanADirectory.png