ClamAV is an open-source antivirus engine designed for detecting viruses, malware, and other malicious software. This cheat sheet provides essential ClamAV commands for scanning files and ensuring the security of your system.

Introduction:

ClamAV is a powerful antivirus solution known for its accuracy in detecting various types of malicious software. It is commonly used to scan files, directories, and emails to prevent the spread of malware.

Updating ClamAV Definitions:

CommandDescription
freshclamUpdate ClamAV virus databases.
freshclam -vUpdate ClamAV with verbose output.
freshclam --show-progressDisplay a progress bar during the update.

Scanning Files and Directories:

CommandDescription
clamscan [file/directory]Scan a file or directory for malware.
clamscan -r [directory]Scan a directory and its subdirectories recursively.
clamscan --remove [file]Remove or quarantine infected files.
clamscan -i [file/directory]Only display infected files.

Scanning Archives:

CommandDescription
clamscan --archive-verbose [file]Scan archives and display verbose output.
clamscan --unrar [file]Enable scanning of RAR archives.

Email Scanning with ClamAV:

CommandDescription
clamscan --mbox [mailbox_file]Scan an mbox format mailbox file.
clamscan --mail [mail_directory]Scan a mail directory for infected emails.

Managing ClamAV Services:

CommandDescription
systemctl start clamav-freshclamStart the ClamAV virus database update service.
systemctl stop clamav-freshclamStop the ClamAV virus database update service.
systemctl start clamav-daemonStart the ClamAV scanning service.
systemctl stop clamav-daemonStop the ClamAV scanning service.

Displaying ClamAV Information:

CommandDescription
clamscan --versionDisplay ClamAV version information.
clamscan --helpDisplay help and usage information.

Conclusion

ClamAV provides robust antivirus protection for systems, and this cheat sheet offers a quick reference for essential commands. Whether you are updating virus databases, scanning files and directories, or managing ClamAV services, these commands will help you ensure the security of your system against malware and malicious software.