True, "Linux is virus free" is a myth. And it's also an extremely inaccurate and vague sentence.
You can read a lot on this topic, and there are a lot of articles explaining you what kind of "virus" (believe me, it's the wrong word to define such things, but let's use it for this discussion) are out there, how a "virus" may harm you, and how unlikely this event can be on a desktop system.
To start I suggest you to read Is Linux Immune to Viruses?
Actually if you:
- use a recent release of Ubuntu that's currently supported
- install only packages from main repositories and Ubuntu Software Center
- set a complex user password
- keep your system constantly updated
- setup ufw firewall
the odds that you get any harm from a "virus" or "malware" are extremely low, approaching zero.
The best thing you can do to protect yourself from potentially harmful "viruses" is to read and learn about system inner workings and security. No software can be as effective as "security device" as knowledge. ;-)
About your experiences: since PlayOnLinux uses Wine to make Windows software run on GNU/Linux, you are able to run most of the software that can run on Microsoft Windows, even viruses. Actually they are a lot less harmful on Ubuntu than on Windows, since Wine isolate them from most of the system, but still they can do something.
What ClamAV found were the exactly the same Windows viruses you could get on Windows. Maybe you got them trying to install something from untrustworthy sources, that you ought to avoid anyway.
So, in conclusion, it's practically true that "Linux is virus free", as long as you stick on the 5 points above. ;-)
I would use cron
for this instead of strictly using bash
. In the directory /etc/cron.daily/
create a small script clamavscan.sh
that looks like:
#!/bin/sh
clamscan /home/username/
Then be sure to make the script executable with chmod +x clamavscan.sh
.
This should run the clamscan of your home directory once daily at 6:25 (as you can see in the file /etc/crontab
).
To have ClamAV scan you entire machine, you should just be able to run clamscan /
, although this might require root privileges to really scan everything.
Best Answer
Terminal
At first you have to update the virus definitions with:
Then you can scan for viruses.
If necessary start with root permissions:
sudo clamscan
.Examples:
To check all files on the computer, displaying the name of each file:
To check all files on the computer, but only display infected files and ring a bell when found:
To scan all files on the computer but only display infected files when found and have this run in the background:
Note - Display background process's status by running the
jobs
command.To check files in the all users home directories:
To check files in the
USER
home directory and move infected files to another folder:To check files in the
USER
home directory and remove infected files (WARNING: Files are gone.):To see more options:
See:
Graphical User Interface: ClamTK
ClamTk is a frontend for ClamAV. You can install it via Terminal with:
You can get the latest version from Bitbucket as Debian package.
There is also a PPA (Outdated):
Scan Menu: Here you can choose a file, folder or a device for scanning
View Menu:
Quarantine Menu:
Advanced Menu:
Help Menu: Here you can check for updates.
See: