How To install and configure ClamAV antivirus in Linux environment
In this article, let us see how to install and configure the ClamAV anti-virus in the Kubuntu Linux environment. Clamav is one of the popular Anti Virus software for the Linux Operating System. It is an Open Source software and is currently maintained and managed by Cisco. Originally it was created for Unix, now it supports Windows and Mac OS also.
Installation
If you are using a Debian variant of Linux (like Ubuntu), then execute the command sudo apt-get install clamav
in the terminal to install ClamAV. This installs the scan engine named clamscan
and a virus signature update tool named freshclam
. For Windows and other operating systems, you can find the download packages here.
Virus Scan
Depending on the kind of operations that you would like to perform in the system, execute the below commands in the terminal appropriately. Although there are some unofficial GUI packages available for clamav, using it in the terminal is simple and straightforward.
# Base Format
$ clamscan [options] [directory or file to scan]
# To scan the current directory
$ clamscan
# To view the version of the scan engine
$ clamscan -V # Capital V
# To scan a specific folder or file
$ clamscan /path or file
# To scan a specific path and its sub-folders
$ clamscan -r /path
# To scan and display only the infected files
$ clamscan -r -i /path
# To save the scan report
$ clamscan -l /path/log-file-name /path
# Move the infected files to a different folder
$ clamscan --move /directory /folder-or-file-to-scan
# Delete the infected files
$ clamscan --remove yes /folder-or-file-to-scan
# Notify the user with a bell sound on identifying infected files
$ clamscan --bell /folder-or-file-to-scan
# Different options in single go
$ clamscan -r --bell --remove yes -l /path/log-file-name /folder-or-file-to-scan
Virus Definition Update
Freshclam runs as a background service and updates the virus signature database in regular intervals. If you would like to manually perform an update, execute the below commands in the terminal. This would stop the Freshclam service and updates the db and finally starts the service back.
$ sudo systemctl stop clamav-freshclam.service
$ sudo freshclam
$ sudo systemctl start clamav-freshclam.service
Leave a comment