Rate This Document
Findability
Accuracy
Completeness
Readability

ClamAV Command Reference

Prerequisites

The ClamAV tool has been installed. For details, see Installation the Tool.

Command Function

Performs a virus scan on the target path.

Syntax

clamscan [options] [file/directory/-]

Parameter Description

Table 1 Parameter description

Parameter

Description

Commonly Used

-h/--help

Obtains help information.

Yes

-l FILE/--log=FILE

Saves the scan report to FILE.

Yes

-r/ --recursive[=yes/no(*)]

Performs recursive scanning, that is, scans subdirectories in the specified directory.

Yes

--copy=DIRECTORY

Copies infected files to DIRECTORY.

Yes

-i/--infected

Prints only infected files.

Yes

--quiet

Outputs only error information

Yes

--official-db-only[=yes/no(*)]

Loads only the official signature.

No

--max-filesize=#n

Skips files larger than this size and assumes them to be clean.

No

--max-scansize=#n

Maximum amount of data to scan in each container file.

No

--leave-temps[=yes/no(*)]

Not to remove temporary files.

No

-f FILE/--file-list-FILE

Scans files from FILE.

No

--bell

Audible alert for virus detection, which can be implemented using external scripts.

No

-cross-fs[=yes(*)/no]

Scans files and directories in other file systems.

No

--bytecode-timeout=N

Sets the bytecode execution timeout (in milliseconds).

No

--heuristic-alerts[=yes(*)/no]

Toggles heuristic alerts.

No

--alert-encrypted[=yes/no(*)]

Alert on encrypted archives and documents.

No

--nocerts

Disables authenticode certificate chain verification in PE files.

No

--disable-cache

Disables caching and cache checks for hash sums of scanned files.

No

-d FILE/DIR/--database=FILE/DIR

Uses the specified file as the virus database to replace the virus database file in the /var/clamav directory.

No

--move=DIRECTORY

Moves infected files to the specified directory.

No

--removes[=yes/no(*)]

Deletes infected files.

No

The ClamAV tool provides many parameters. This table lists only some of them. To view all parameters and their descriptions, run clamscan -h.

Example

After updating the virus database, the following example scans files in /var/log/ and outputs the scan report to clamav.log. Replace the example path with the actual path.

clamscan -i -r /var/log/ -l clamav.log
Figure 1 Virus scan result