Use ClamAV to protect your Linux systems.

ClamAv Antivirus To Safeguard Linux

ClamAV is an open-source command line antivirus software using which you can protect your system against millions of malware and Trojans. Although you usually do not need antivirus programs on Linux desktops, because most of the viruses are programmed keeping Windows in mind (because it has more users).

But it is always nice to have since you can always store and spread viruses to other systems if you physically copy any infected file to a Windows PC. Also, if you have WINE or proton installed, you are not immune to those Windows viruses.

In this tutorial, we will look at some of the features of this antivirus software and also learn how to install and use it on different Linux distributions.

Installing ClamAV on Linux

The installation procedure is really simple as it is available in the official repositories of mostly all Linux distributions. Just open a terminal window and type the following commands:

# On Debian and Ubuntu based distributions:
sudo apt update && sudo apt install clamav clamav-daemon

# On Fedora workstation:
sudo dnf install clamav clamd clamav-update -y

# On Arch Linux
sudo pacman -S clamav
Installing ClamAV On Fedora
Installing ClamAV On Fedora

Setting up ClamAV

Once the installation is finished, you have to manually update its signature database. You can do so by typing the following commands in your Terminal:

# Stop the freshclam service
sudo systemctl stop clamav-freshclam

Now, simply update your database by typing:

sudo freshclam

If this command does not work for some reason, you can manually download the signature database by clicking on this link. Now, create a directory somewhere and place this downloaded file in that folder.

sudo mkdir /var/lib/clamav
sudo mv ~/Downloads/daily.cvd /var/lib/clamav/daily.cvd
Adding A Daily Signature Database To This Antivirus
Adding A Daily Signature Database To This Antivirus

Now, you can start the daemon which we stopped earlier. Just type:

sudo systemctl restart clamav-freshclam
Starting The Antivirus Daemon
Starting The Antivirus Daemon

Scanning for Viruses on Linux using Clamscan

You can scan for malware on your system by typing the following command:

sudo clamscan -r -i /FOLDER/PATH
Scanning A Directory For Viruses On Linux
Scanning A Directory For Viruses On Linux

In the above command, -i option tells the clamscan command to only report if any file inside a directory is infected, and the -r option tells it to scan the specified directory recursively. Note that it can take a lot of time depending on how large your directory is.

You can also enable a bell to ring when the scan finishes. You can do that by adding the –bell command option.

You also have the option to save a scan report to a file, you can do that by typing the command like this:

sudo clamscan -ir /bin/ -l report.txt

I also noticed that it was only utilizing one or two threads out of the 12 present in my CPU.

This Antivirus Seems To Put Pressure On Only One Or Two CPU Threads
This Antivirus Seems To Put Pressure On Only One Or Two CPU Threads

To avoid this issue on any old hardware, you can use the nice command before every clams can like this:

sudo nice -n 15 clamscan && sudo clamscan  -ir /home/USER/Documents


It is a well-known fact that with the widespread use of technology and the internet, the risk of cyber threats and malware attacks has significantly increased. As a result, it has become extremely important to ensure the security of your computer and personal data by following some basic security measures. One of the most important things you can do is to keep your operating system and other software up-to-date.

Another important security measure is to enable the firewall on your device. The firewall acts as a barrier between your computer and the internet, blocking unauthorized access to your device. This helps to prevent malware from infecting your system and stealing personal information. Additionally, you should also be mindful of the types of websites you visit and the downloads you make. Avoid downloading software or visiting websites that are known to be malicious or have a reputation for distributing malware.

Lastly, it is always a good idea to run an antivirus scan on your computer once in a while. This helps to detect and remove any existing malware on your system. ClamAV is a popular antivirus software that you can use to perform regular scans on your computer. This will help you to ensure that your system is not infected by any malicious software that may have slipped through your other security measures.


Official Documentation