Nov 10, 2018

How to scan for viruses with ClamAV in Linux

ClamAV is an open source antivirus engine for detecting trojans, viruses, malware & other malicious threats. It is used in a variety of situations including email scanning, web scanning, and endpoint security. It provides a number of utilities including a flexible and scalable multi-threaded daemon, a command line scanner and an advanced tool for automatic database updates.

It is cross-platform. 

For example in Ubuntu, to install:

$ sudo apt-get install clamav

For Fedora & EPEL ( CentOS and RHEL )
$ sudo yum install clamav

To use in Terminal:

At first you have to update the virus definitions with:

sudo freshclam

Then you can scan for viruses.
 clamscan OPTIONS File/Folder 

To check all files on the computer, displaying the name of each file:

clamscan -r /

To check all files on the computer, but only display infected files and ring a bell when found:

clamscan -r --bell -i /

To check files in the USER home directory and move infected files to another folder:

clamscan -r --move=/home/USER/VIRUS /home/USER
To check files in the USER home directory and remove infected files (WARNING: Files are gone.):

clamscan -r --remove /home/USER
To see more options:

clamscan --help

Graphical User Interface: ClamTk install clamtk
ClamTk is a frontend for ClamAV. You can install it via Terminal with:
sudo apt-get install clamtk
There is also a PPA with the latest version:
sudo apt-add-repository ppa:landronimirc/clamtk
sudo apt-get update && sudo apt-get install clamtk

Sign up for Google Apps with the following promo codes: