Raspberry Pi

How to Install ClamAV on Raspberry Pi 4

The ClamAV is an open-source antivirus that is used to detect the virus and protect the system by monitoring the websites, scanning the emails, and the files of the computer, moreover, the package of the ClamAV is released for different operating systems including macOS, Windows, and Linux.

In this write-up, we will explore a method to install the ClamAV on Raspberry Pi which is a Debian-based distribution of Linux.

How to install ClamAV on Raspberry Pi 4

We will update the default repository of the Raspberry Pi using the command:

$ sudo apt update && sudo apt full-upgrade -y

Then we will install the clamAV using the apt package manager:

$ sudo apt install clamav -y

To check the version of the installed clamAV, we will use the command:

$ clamscan --version

To scan the Raspberry Pi, we will use the command:

$ clamscan

To find all the options used with the clamscan command we will open its help:

$ clamscan --help

We can also scan the multiple directories recursively by using the “-r” option with the clamscan command:

$ clamscan -r /home /home/Downloads

To remove the infected files from the multiple directories we will simply add the “–remove” option:

$ clamscan -r --remove /home /home/Downloads

Likewise if we want to move all the infected files to some directory rather than to remove them, we will use the option, “–move=[directory path where you want to move infected file]”, for example, we will move the infected files of the home directory to the /pi/home/infected using the command:

$ clamscan -r --move=/home/pi/infected /home

If we want that the clamav should only report the infected files then we will use the “-i” flag:

$ clamscan -ir /home

Conclusion

The ClamAV also has support for scanning and detecting the virus from the text files of different formats like the word, pdf, and HTML. in this write-up, the methods of installing and using the ClamAV is discussed in detail.

About the author

Hammad Zahid

I'm an Engineering graduate and my passion for IT has brought me to Linux. Now here I'm learning and sharing my knowledge with the world.