High Performance Starts Here — AMD Dedicated Servers

English

Home

Blog

How To Use maldet to Scan & Remove Malwa...

How To Use maldet to Scan & Remove Malware on Linux Server

How To Use maldet to Scan & Remove Malware on Linux Server

NetShop ISP

NetShop ISP · Blog Author

Jul 19, 2023 · Technical Tutorials

Following our previous guide on how to install maldet on linux server, in this article we will demonstrate some useful maldet commands for detecting and quarantining/removing malware.

Remember, that, depending on the structure of your filesystem and how deep your scanning will go, maldet may consume considerable amount of resources, so use with caution!

Generally, the steps you need to follow on a typical day is Scan the server/directories, Analyze the results, and Action (Remove/Quarantine files) if needed.

Scan Specific Files/Folders with maldet

Use the following command if you want maldet to scan recursively the entire directory under /var/. This means files under /var/, sub-directories such as /var/www/html/, and so on.

root@localhost:~$ maldet -a /var/

Important: Depending on the size of the directory you wish to scan, and the number of sub-folders and files under that directory, maldet can take a significantly long time to complete which may result in server’s memory exhaustion.

Check maldet Scan Report

You can view the full scan report using the following command. Replace <Scan_ID> with the ID of the scan which will be provided as soon as maldet completes its scanning process.

root@localhost:~$ maldet -e <Scan_ID>
or
root@localhost:~$ maldet --report <Scan_ID>

A sample of the provided report is shown below.

Maldet Scan Report Sample Output

Remove Malicious Files Detected by maldet

Assuming your maldet scan identified malware or files with malicious code, these will be counted as “Hits” in maldet’s scan report.

You can remove them by executing the following command – make sure you replace <Scan_ID> with the correct scan report id.

root@localhost:~$ maldet -q <Scan_ID>
or
root@localhost:~$ maldet --quarantine <Scan_ID>

It’s preferred using the quarantine option to remove malicious files, as this will allow you to restore files that may have been wrongly identified as malware (known as false positives).

You can do so by executing the following command:

root@localhost:~$ maldet -s folder/file
or
root@localhost:~$ maldet --restore folder/file

That’s it! In this article we have demonstrated the commands to scan your linux server with maldet, view the scan report, delete the malicious files identified by a scan and restore files/folders from a specific scan job.

how to
linux
maldet
security
tutorials
Press Releases
97
Industries
122

Free VPS Trial

No Credit Card Required.

Start Your VPS Hosting Free Trial

Recent Posts

Hermes AI Agent VPS - Deploy in 1 Click

Introducing Hermes Agent VPS: Your Own AI Agent, Live in One Click

22 July 2026

How To Protect Your Website from DDoS Attacks in 2026

How To Protect Your Website from DDoS Attacks in 2026

14 July 2026

Why Your Stream Keeps Buffering (And How to Fix It)

Why Your Stream Keeps Buffering (And How to Fix It)

08 July 2026

How to Secure Your WordPress Website in 2026

How to Secure Your WordPress Website in 2026

30 June 2026

How To Fix Outdated Theme on cPanel / WHM

Why Your cPanel or WHM Login Page Is Showing an Outdated Theme (And How to Fix It)

22 June 2026