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:
Command
Description
freshclam
Update ClamAV virus databases.
freshclam -v
Update ClamAV with verbose output.
freshclam --show-progress
Display a progress bar during the update.
Scanning Files and Directories:
Command
Description
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:
Command
Description
clamscan --archive-verbose [file]
Scan archives and display verbose output.
clamscan --unrar [file]
Enable scanning of RAR archives.
Email Scanning with ClamAV:
Command
Description
clamscan --mbox [mailbox_file]
Scan an mbox format mailbox file.
clamscan --mail [mail_directory]
Scan a mail directory for infected emails.
Managing ClamAV Services:
Command
Description
systemctl start clamav-freshclam
Start the ClamAV virus database update service.
systemctl stop clamav-freshclam
Stop the ClamAV virus database update service.
systemctl start clamav-daemon
Start the ClamAV scanning service.
systemctl stop clamav-daemon
Stop the ClamAV scanning service.
Displaying ClamAV Information:
Command
Description
clamscan --version
Display ClamAV version information.
clamscan --help
Display 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.