This question already has an answer here:

I think I may have a virus. How would I go about checking for a virus and how can I protect my computer from any other virus? Please give detailed answer as I'm still learning about Ubuntu.

marked as duplicate by BuZZ-dEE, Eric Carvalho, Florian Diesch, blade19899, user117103 Feb 6 '14 at 21:23

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • @Alvar: False. While more resilient than Windows, it is technically possible to get a virus on Ubuntu. en.wikipedia.org/wiki/Linux_malware#Viruses_and_trojan_horses – roadmr Feb 6 '14 at 19:40
  • @Alvar It isn't technically impossible, but it is very hard and almost unheard of. – Seth Feb 6 '14 at 19:40
  • What makes you think you have a virus? – roadmr Feb 6 '14 at 19:41
  • There are plenty of malwares aimed at Linux distros. People are making botnet out of everything these days. Anything that can be connected to the internet can be attacked. – Sam Redway Nov 2 '16 at 21:35

To scan for viruses on Linux, you'd us clamav. You can install it from the repositories using the software center.

If you're new to Linux, this is the perfect time to try out the command line interface, because it works well, and it's hard to screw anything up.

If you're feeling up to it, open a teminal window by typing <alt><control><t>.

In that window, type sudo apt-get install clamav. This will tell the computer that a "super user" is telling it to install the clamav virus scanning software. It will ask for your password.

Now that you've installed the software, you need to update the files that it uses to identify viruses. You should type sudo freshclam. Your computer will know you're a super user because you just typed in your password a few seconds ago.

When all is done, you're ready to scan. If you'd like to scan your home directory (all your user files), you'd type something like

 clamscan --remove=yes -i -r ~/

This calls on clamscan to remove any virus it finds, show you only infected files, to act recursively by running through every subdirectory of you home directory. ~/ is shorthand for your home directory. You might want to run it without the --remove just to see what it finds first.

if you were to type man clamscan you'd see a list of options. As I said, this is a great place to start using the command line.

  • What's the expected result from running clamscan? Without sudo I'm getting killed as a return and with sudo I get nothing. Using --log=FILE complains about privileges. – Elliot Lewis Jun 6 '16 at 11:02
  • 6
    I noticed that when you install clamav it runs freshclam in the background by default. I'm thinking that this is happening because when I tried to run freshclam I got a file lock exception due to another process accessing the log. So you will probably have to wait an hour or so after installing to run the update yourself if you feel that it is necessary. If you don't want to wait you can do sudo /etc/init.d/clamav-freshclam stop then start the update with sudo freshclam -v and when that finishes run sudo /etc/init.d/clamav-freshclam start ubuntuforums.org/showthread.php?t=1032147 – kpie Oct 21 '16 at 4:57

Avast! has free antivirus for Linux, which you can use to check Ubuntu for viruses and remove if any were found. Here is how you can install it.

  1. Download it form here
  2. Open the file and install it
  3. register your free account here
  4. You must change Ubuntu's shmmax to accept updates(as they are too big). This is how you can do this. Open terminal (Ctrl + Alt + T) and enter:

    gksudo gedit /etc/init.d/rcS

    Add this line of code in a new line directly before the line, which should already be there, exec /etc/init.d/rc S

    sysctl -w kernel.shmmax=128000000
  5. Save it and restart computer

  • 4
    Of course, you'd have your security to closed-source software. If I wanted to do that, I'd run Windows or OSx. And you're really searching your email for Windows viruses anyway. – Marc Feb 6 '14 at 20:45
  • I agree with you on this, but the fact is, you cannot have everything open source. – Dusan Milosevic Feb 6 '14 at 20:48
  • 3
    Perhaps everyone can't but I can come as close as possible, especially with security software. – Marc Feb 6 '14 at 21:02

Not the answer you're looking for? Browse other questions tagged or ask your own question.