clamscan(1)
πΈ clamscan(1) β Clam AntiVirus πΈ
okay bestie, buckle up π this is clamscan from the Clam AntiVirus manual, section 1, and she's a whole icon.
β¨ NAME β¨
clamscan β scan files and directories for viruses π¦ π
β¨ SYNOPSIS β¨
clamscan [options] [file/directory/-]
β¨ DESCRIPTION β¨
clamscan is a command line anti-virus scanner. that's it, that's the vibe. it goes through your files and tells you what's sus π
β¨ OPTIONS β¨
okay so most of these are just lil switches that turn stuff on and off, no big deal. but the ones marked with [=yes/no(*)] can optionally be followed by =yes or =no β and if you call them without the boolean argument, the scanner just assumes 'yes' bc she's generous like that. the asterisk * marks the default internal setting for that option, iykyk π
-h,--helpβ print help info and dip. bye β¨-V,--versionβ print the version number and exit. flex the build π-v,--verboseβ be verbose. like, talk more.-a,--archive-verboseβ show the filenames inside scanned archives π--debugβ display debug messages coming out of libclamav π--quietβ be quiet. only error messages get through π€«--stdoutβ write all messages (except for libclamav output) to standard output (stdout).--no-summaryβ do not display the summary at the end of scanning. no little recap for you π-i,--infectedβ only print infected files. main character files only π-o,--suppress-ok-resultsβ skip printing the OK files. we don't need the good news, apparently.--bellβ sound the bell when a virus is detected π (dramatic and honestly? deserved)--tempdir=DIRECTORYβ create temporary files in DIRECTORY. heads up: that directory has to be writable for the'clamav'user, or for whatever unprivileged user is running clamscan.--leave-tempsβ do not remove temporary files. let them linger π«Ά--force-to-diskβ this one makes memory or nested map scans dump their content to disk. if you turn it on, more data gets written to disk and it becomes available when theLeaveTemporaryFilesoption is enabled.--gen-jsonβ generate a JSON description of the scanned file(s). the JSON gets printed and also dropped into the temp directory if--leave-tempsis enabled π--json-store-html-urisβ store html URIs in metadata. the URIs get written to themetadata.jsonfile in an array called'URIs'.--json-store-pdf-urisβ store pdf URIs in metadata. those URIs also get written to themetadata.jsonfile in an array called'URIs'.--json-store-extra-hashesβ store md5 and sha1 in addition to sha2-256 in metadata. more hashes, more power β-d FILE/DIR,--database=FILE/DIRβ load the virus database from FILE, or load all the virus database files from DIR.--official-db-only=[yes/no(*)]β only load the official signatures published by the ClamAV project. nothing unofficial in this house π«--fail-if-cvd-older-than=daysβ return with a nonzero error code if the virus database is older than the specified number of days. expired db? we're failing, periodt β°-l FILE,--log=FILEβ save the scan report to FILE.-r,--recursiveβ scan directories recursively. every single subdirectory inside the given directory gets scanned. the whole family tree π³-z,--allmatchβ after a match, keep scanning inside the file for additional matches. don't stop at the first one, we're thorough π--cross-fs=[yes(*)/no]β scan files and directories on other filesystems.--follow-dir-symlinks=[0/1(*)/2]β follow directory symlinks. three whole modes bestie:0β never follow directory symlinks;1(the default) β only follow directory symlinks that are passed as direct arguments to clamscan;2β always follow directory symlinks.--follow-file-symlinks=[0/1(*)/2]β follow file symlinks. same three flavors:0β never follow file symlinks;1(the default) β only follow file symlinks that are passed as direct arguments to clamscan;2β always follow file symlinks.-f FILE,--file-list=FILEβ scan files listed line by line in FILE. a whole guest list π--remove[=yes/no(*)]β remove infected files. be careful! β οΈ like, genuinely. that's a delete. no undo. no takebacks.--move=DIRECTORYβ move infected files into DIRECTORY. that directory must be writable for the'clamav'user or for the unprivileged user running clamscan.--copy=DIRECTORYβ copy infected files into DIRECTORY. same deal, directory must be writable for the'clamav'user or the unprivileged user running clamscan.--exclude=REGEX,--exclude-dir=REGEXβ don't scan file/directory names that match the regular expression. you can use these options multiple times π--include=REGEX,--include-dir=REGEXβ only scan file/directory names that match the regular expression. also usable multiple times π--bytecode[=yes(*)/no]β with this on, ClamAV will load bytecode from the database. and ngl? it's highly recommended you keep this turned on, otherwise you may miss detections for many new viruses π--bytecode-unsigned[=yes/no(*)]β allow loading bytecode from outside digitally signed.c[lv]dfiles. Caution: you should NEVER run bytecode signatures from untrusted sources. doing so may result in arbitrary code execution πππ like that's not a vibe at all.--bytecode-timeout=Nβ set the bytecode timeout in milliseconds (default:10000= 10s) β±οΈ--statistics[=none(*)/bytecode/pcre]β collect and print execution statistics π--detect-pua[=yes/no(*)]β detect Possibly Unwanted Applications. the shady-but-not-quite-virus crowd π--exclude-pua=CATEGORYβ exclude a specific PUA category. can be used multiple times. seehttps://docs.clamav.net/faq/faq-pua.htmlfor the complete list of PUA.--include-pua=CATEGORYβ only include a specific PUA category. can be used multiple times. also seehttps://docs.clamav.net/faq/faq-pua.htmlfor the complete list of PUA.--detect-structured[=yes/no(*)]β use the DLP (Data Loss Prevention) module to detect SSN and Credit Card numbers inside documents/text files π--structured-ssn-format=XβX=0: search for valid SSNs formatted asxxx-yy-zzzz(normal);X=1: search for valid SSNs formatted asxxxyyzzzz(stripped);X=2: search for both formats. default is0.--structured-ssn-count=#nβ this option sets the lowest number of Social Security Numbers found in a file needed to generate a detect (default:3).--structured-cc-count=#nβ this option sets the lowest number of Credit Card numbers found in a file needed to generate a detect (default:3).--scan-mail[=yes(*)/no]β scan mail files. if you turn this off, the original files still get scanned, just without parsing individual messages/attachments βοΈ--phishing-sigs[=yes(*)/no]β enable email signature-based phishing detection π£--phishing-scan-urls[=yes(*)/no]β enable URL signature-based phishing detection (Heuristics.Phishing.Email.*)--heuristic-alerts[=yes(*)/no]β in some cases (eg. complex malware, exploits in graphic files, and others), ClamAV uses special algorithms to provide accurate detection. this option controls that algorithmic detection π§--heuristic-scan-precedence[=yes/no(*)]β allow heuristic matches to take precedence. when enabled, if a heuristic scan (such as phishingScan) detects a possible virus/phish, it will stop the scan immediately. recommended, saves CPU scan-time. when disabled, viruses/phishes detected by heuristic scans will be reported only at the end of a scan. if an archive contains both a heuristically detected virus/phish and a real malware, the real malware will be reported. keep this disabled if you intend to handle"Heuristics.*"viruses differently from"real"malware. if a non-heuristically-detected virus (signature-based) is found first, the scan is interrupted immediately, regardless of this config option. yeah, it's a lot, read it twice bestie π--normalize[=yes(*)/no]β normalize (compress whitespace, downcase, etc.) html, script, and text files. usenormalize=nofor yara compatibility.--scan-pe[=yes(*)/no]β PE stands for Portable Executable β it's an executable file format used in all 32-bit versions of Windows operating systems. by default ClamAV performs deeper analysis of executable files and attempts to decompress popular executable packers such as UPX, Petite, and FSG. if you turn this option off, the original files still get scanned but without additional processing.--scan-elf[=yes(*)/no]β Executable and Linking Format is a standard format for UN*X executables. this option controls the ELF support. if you turn it off, the original files still get scanned but without additional processing.--scan-ole2[=yes(*)/no]β scan Microsoft Office documents and.msifiles. if you turn this option off, the original files still get scanned but without additional processing.--scan-pdf[=yes(*)/no]β scan within PDF files. if you turn this option off, the original files still get scanned, but without decoding and additional processing.--scan-swf[=yes(*)/no]β scan SWF files. if you turn this option off, the original files still get scanned but without additional processing.--scan-html[=yes(*)/no]β detect, normalize/decrypt and scan HTML files and embedded scripts. if you turn this option off, the original files still get scanned, but without additional processing.--scan-xmldocs[=yes(*)/no]β scan xml-based document files supported by libclamav. if you turn this option off, the original files still get scanned, but without additional processing.--scan-hwp3[=yes(*)/no]β scan HWP3 files. if you turn this option off, the original files still get scanned, but without additional processing.--scan-archive[=yes(*)/no]β scan archives supported by libclamav. if you turn this option off, the original files still get scanned, but without unpacking and additional processing π¦--scan-image[=yes(*)/no]β this option enables scanning of image (graphics) files. if you turn this option off, the original files still get scanned, but without additional processing πΌοΈ--scan-image-fuzzy-hash[=yes(*)/no]β this option enables detection by calculating a fuzzy hash of image (graphics) files. signatures using image fuzzy hashes typically match files and documents by identifying images embedded or attached to those files. if you turn this option off, then some files may no longer be detected π--alert-broken[=yes/no(*)]β alert on broken executable files (PE & ELF). cracked ones count too π©Ή--alert-encrypted[=yes/no(*)]β alert on encrypted archives and documents (encrypted.zip,.7zip,.rar,.pdf). secrets stay sus π--alert-encrypted-archive[=yes/no(*)]β bestie, this one yells at you when it clocks an encrypted archive (that's encrypted.zip,.7zip,.rar,.pdf). π«Ά--alert-encrypted-doc[=yes/no(*)]β same energy but for encrypted documents (also encrypted.zip,.7zip,.rar,.pdf). β¨--alert-macros[=yes/no(*)]β alerts on OLE2 files that are hiding VBA macros in them, which it callsHeuristics.OLE2.ContainsMacros. macros? in my OLE2 file? it's more likely than you think π--alert-exceeds-max[=yes/no(*)]β alerts when a file blows past max file size, max scan size, or the max recursion limit. the flag name for that whole mood isHeuristics.Limits.Exceeded. π€--alert-phishing-ssl[=yes/no(*)]β alerts on emails with SSL mismatches in their URLs. > heads up bestie: this one might lead to false positives! so don't come for it when it gets a lil dramatic π--alert-phishing-cloak[=yes/no(*)]β alerts on emails packing cloaked URLs. > also possibly false-positive-prone, so take it with a grain of salt (might lead to some false positives). β¨--alert-partition-intersection[=yes/no(*)]β heuristics time! this detects partition intersections inside raw disk images. π--nocertsβ turns off authenticode certificate chain verification in PE files. no verifying, just vibes. π--dumpcertsβ the opposite mood: dumps the authenticode certificate chain out of PE files. show me everything π--max-scantime=#nβ the absolute longest it'll keep scanning before it gives up on you. value's in milliseconds. set it to0and the limit is gone, poof, disabled. this is your armor against DoS attacks, so don't be reckless. (default:120000= 120s or 2min)--max-filesize=#nβ extract and scan at most#nbytes from each archive. you can hand it kilobytes likexKorxk, or megabytes likexMorxm, wherexis a number. DoS protection, periodt. (default: 100 MB, max: 2 GB)--max-scansize=#nβ extract and scan at most#nbytes from each archive. here's the tea: the size of the archive plus the sum of all the files inside it both count toward the scan size. like, a 1M uncompressed archive with a single 1M inner file counts as2Mtoward max-scansize. kilobytes come asxKorxk, megabytes asxMorxm,xbeing a number. DoS protection again π‘οΈ (default: 400 MB)--max-files=#nβ extract at most#nfiles from each scanned file (and yeah, that means when the scanned thing is an archive, a document, or any other kind of container). more DoS protection. (default: 10000)--max-recursion=#nβ sets the archive recursion level limit. DoS protection, obviously. (default: 17) (maximum: 100).--max-dir-recursion=#nβ how deep directories get scanned. (default: 15).--max-embeddedpe=#nβ biggest file it'll check for embedded PE. kilobytes asxKorxk, megabytes asxMorxm,xis a number (default: 40 MB).--max-htmlnormalize=#nβ biggest HTML file it'll normalize.xK/xkfor kilobytes,xM/xmfor megabytes,xa number (default: 40 MB).--max-htmlnotags=#nβ biggest normalized HTML file it'll scan.xK/xk,xM/xm,x= number (default: 8 MB).--max-scriptnormalize=#nβ biggest script file it'll normalize.xK/xk,xM/xm,x= a number (default: 20 MB).--max-ziptypercg=#nβ biggest zip it'll type reanalyze.xK/xk,xM/xm,x= number (default: 1 MB).--max-partitions=#nβ max number of partitions of a raw disk image that get scanned. gotta be a positive integer (default: 50).--max-iconspe=#nβ max number of icons inside a PE that get scanned. must be a positive integer (default: 100).--max-rechwp3=#nβ max recursive calls to the HWP3 parsing function (default: 16).--pcre-match-limit=#nβ max calls to the PCRE match function (default: 100000).--pcre-recmatch-limit=#nβ max recursive calls to the PCRE match function (default: 2000).--pcre-max-filesize=#nβ biggest file that gets PCRE subsig matching (default: 100 MB).--disable-cacheβ kills caching and cache checks for the hash sums of scanned files. fresh every time, no stored receipts β¨--hash-hintβ you hand over the file hash so libclamav doesn't have to calculate it. the type of hash has to match'--hash-alg'or it's not gonna work. π--log-hashβ prints the file hash after each file scanned. what type of hash gets printed? whatever'--hash-alg'says. π--hash-algβ the hashing algorithm used for either'--hash-hint'or'--log-hash'. supported ones are"md5","sha1","sha2-256". if you don't specify, it defaults to"sha2-256". π₯--file-type-hintβ a file type hint so libclamav can optimize scanning. like"pe","elf","zip", etc. you can also use ClamAV type names like"CL_TYPE_PE". if it doesn't recognize the type you gave it, ClamAV just ignores the hint, no hard feelings. see also: https://docs.clamav.net/appendix/FileTypes.html#file-types π¦--log-file-typeβ prints the file type after each file scanned.--cvdcertsdir=DIRβ point it at a directory holding the root CA cert needed to verify detached CVD digital signatures. if you don't provide one, clamscan goes looking in the default directory. π§--fips-limitsβ enforces FIPS-like limits on using hash algorithms for cryptographic purposes. this disables MD5 & SHA1 FP sigs and requires'.sign'files to verify CVD authenticity. not messing around with this one π
πΈ ENVIRONMENT VARIABLES πΈ
clamscan vibes with these environment variables:
LD_LIBRARY_PATHβ may be used on startup to find thelibclamunrar_ifaceshared library module, which is what enables RAR archive support. that's the whole plug π«ΆCVD_CERTS_DIRβ specify a directory containing the root CA cert needed to verify detached CVD digital signatures. if it's not provided, clamscan looks in the default directory. π
β¨ EXAMPLES β¨
(0) scan a single file:
clamscan file
(1) scan the current working directory:
clamscan
(2) scan all files (and subdirectories) in /home:
clamscan -r /home
(3) load the database from a file:
clamscan -d /tmp/newclamdb -r /tmp
(4) scan a data stream:
cat testfile | clamscan -
(5) scan a mail spool directory:
clamscan -r /var/spool/mail
π RETURN CODES π
0: no virus found. ate and left no crumbs π1: virus(es) found. not the vibe π2: some error(s) occurred. it's giving chaos π
π CREDITS π
please check the full documentation for credits. iykyk π
π AUTHOR π
Tomasz Kojm <tkojm@clamav.net>, Kevin Lin <klin@sourcefire.com> β icons, both of them β¨
π¦ SEE ALSO π¦
clamdscan(1), freshclam(1), freshclam.conf(5)
and that's the whole page bestie!! π this is from <b>ClamAV 1.5.4</b>, dated <b>December 4, 2013</b> (yes girl, that date is doing time travel, don't ask), and it's the clamscan(1) manual. go scan something, you're the main character now ππ
π¦ where this page comes from
- arch rolling: clamav 1.5.4-1 Β· GPL-2.0-only
- nixpkgs unstable: clamav 1.5.4
- ubuntu jammy: clamav 1.5.4+dfsg-0ubuntu0.22.04.1 Β· GPL-2.0-only
- ubuntu noble: clamav 1.5.4+dfsg-0ubuntu0.24.04.1 Β· GPL-2.0-only
- ubuntu resolute: clamav 1.5.4+dfsg-0ubuntu0.26.04.1 Β· GPL-2.0-only
- ubuntu stonking: clamav 1.5.4+dfsg-0ubuntu1 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms