How to scan for virus using ClamAV – Linux

Hi Guys, it is possible to have malware and virus attacks in our linux systems also, there is an antivirus application called ClamAV which can protect you from malware and threats. Some information on the ClamAV antivirus and its functionalities are shown below and I believe it can help you to find threats and infected files in a simple way.

ClamAV is an open source antivirus engine that is used for detecting Trojans, viruses, malware and other malicious threats. It is the de facto standard for mail gateway scanning. Its performance is relatively high and it provides a mutli-threaded scanning daemon, command line utilities and an intelligent tool for automatic signature updates.

You can install the ClamAV using the command line shown below.

# sudo apt-get install clamav

Before performing the virus scan, the virus definitions are need to be updated, the following line will help you to do the same.

# sudo freshclam

Now you can scan the files for viruses in various methods, some of them are pasted below.

The general syntax is  :

clamscan OPTIONS file/folder

  1. To check all the files on the system :

# clamscan -r /

  1. Scan all the files and subdirectories in /home

# clamscan  -r /home

3. Scan a mail spool directory:

# clamscan -r /var/spool/mail

Return Codes

0 : No virus found. 1 : Virus(es) found.2 : Some error(s) occured.

Leave a Reply

Your email address will not be published. Required fields are marked *