Anti virus for Linux

Using an anti virus software in my Linux machine is something that I have not given much thought to. I know for the fact that the odds for a Linux system to get affected by a malware is pretty low. As of my understanding, the fact that Linux systems use open source software is a big bonus here. I mean, why would some one bother in sitting and writing a harmful program when everyone can see your code. Also crackers aim at a much elaborate target. I am sure they have better things to do than messing with some Linux users, which is only 2% of world computer users’ population. Still, there are executable files that may get into your system via mails or flash drives. But in Linux, nothing will happen if you simply double click an executable file (provided you don’t have Wine installed). It won’t get executed unless you give it permission for execution. This is much unlikely to happen as Linux users are supposed to know what they are doing (Myself excluded!). And of course, there are many more reasons like user privileges, simplicity of kernal, etc.

But this doesn’t mean that we don’t need an anti virus software installed. For instance, as in my case, I thought of  using an anti virus software when my windows using friends started blaming me for spreading malwares via flash drives. And also, being a music junkie, I constantly give my phone a hard time copying downloaded files to it from my computer.

After going through several forums, I decided to go for clamAV. It is an absolutely open source anti virus software. You can install the package clamav or clamtk (If you want the GUI).

sudo apt-get install clamav

Now to start scanning, run the following command in the terminal.

clamscan -r  <folder or file to be scanned>

(-r as in recursive)

Now update your virus database definitions by running the command :


You may also want to uncomment the line that includes the path to the local socket in the clamd.conf file (/etc/clamav/clamd.conf).

Now we are good to go.


Quick tip: Installing a software in linux using files in .run format

The .run files are binary executable files. These files need to be executed to install the software. Such files are often considered as unsafe as we cannot find a way to uninstall them and we cannot say what the code will do to your system. But some games and apps are available that are packaged in this file format. Installing using .run file is rather easy.

First of all download the required .run file.

For example, in your terminal run the command:

wget -c < URL to the .run file >

(Get the .run file as you wish. I just mentioned wget here because it is one of my favorite GNU/Linux utilities. It enables a very nifty download of files from internet and the tab -c can help you get data from a partially downloaded file. If the file to be downloaded is quite bulky and you don’t trust your Internet connection then -c tab is what you need.)

Method 1:

Go to the directory where the .run file is saved and run the following command in your terminal:

chmod +x

Here I have arbitrarily named my .run file as Here we are using +x to give permission for the owner to execute the file as a program. (If we replace +x with ugo+x, then the user, group and others will get the permission to execute that file as well.)

Now run the executable file, that is, run the command :


Now the installer will run.

Method 2:

We can do the same steps rather interactively as below.

Right click the .run file and select properties. Under the permission tab check the box that says ‘Allow executing file as program’ and click close.

Double click the .run file and select ‘Run in terminal’.

This will run the installer.

Both worked perfectly in Ubuntu 12.04. If different in other distros please let me know.

Recovering lost password in Ubuntu 12.04

Yesterday, While I was trying to help my friend with his lost Ubuntu password, I explored the following two methods to do this quite easily.

First method is using the recovery mode. This method is pretty simple.

In the grub menu, select the recovery mode. Then in the menu that appear, scroll down to the option ‘Drop to root shell prompt’. Now you will get a shell prompt with root authentication at the bottom of the screen. Now before changing the password we have to remount the root in read write mode and for that run the following command.

            mount -rw -o remount /

Now go ahead and change the password of the corresponding user using the following command.

            passwd <username>

Now the prompt will ask for the new password. After entering it twice, as will be asked by the prompt, exit from the prompt by just entering exit. Now select the resume normal booting option. Sometimes when booting into the system from recovery mode can give you a disoriented display screen and simple restarting is the solution for this.

Although the above method worked just fine in my system, my friend didn’t have much luck in making this work in his system ( God knows why. ). So I tried another method and that is using the live CD. The steps I followed are as follow :

1. Boot into the Ubuntu live CD and select the option try Ubuntu.

2. Open  the terminal and mount the partition that is the root partition for your actual Ubuntu as mount point.

  • If you don’t know the root partition, open gparted and see which drive is set as bootable.

Suppose /dev/sda1 is your root partition. Now to mount it as the mount point run the command :

   sudo mount /dev/sda1 /mnt

3. Make this mount point as root and for this we use chroot :

sudo chroot /mnt

4. Now you can proceed with changing password of the corresponding user, i.e. :

  sudo passwd <username>

Enter the new password as asked.

5. Un-mount the root partition

umount /mnt

6. Restart the system and now you can log in to your system with the new password.

I found some more methods too, online, but the above two worked perfectly for me. So didn’t bother to experiment with anything else. Hope this works for my friend too.

GNU Project Debugger

Today I came across a very nifty tool on my linux system. It is GNU Project Debugger a.k.a GDB. It is the standard debugger in UNIX. It lets you poke around your program and find out what is wrong with your program, if it crashed or gave you unexpected results. It can be used to debug programs written in Ada, Java, Pascal etc.( Although I haven’t tried it yet on anything other than C programs). So, yeah, it is a very powerful tool. I played around with it for a little while and it seems pretty easy. I am sure if I give it a little more effort, I sure can make best friends with GDB pretty soon. I wish I knew  GDB six months ago when I kept getting segmentation faults in my Data structures lab.

To startup GDB all you need to do is, in your terminal, go to the folder where you have the executable code of your crashed program and run the following command :

gdb <exe filename>

for eg. :

gdb ./a.out 

(a.out being the default name for an executable file)

Once you did run that command, it will show some copyright information and finally you’ll get a (gdb) prompt. Now you can poke around your executable source code as you wish. To run the program inside gdb all you need to do is run the command run. There are many nifty commands in there, like next– to move around the program line-by-line, print– to print the value of each variable, break– to set the breakpoint (And this is a pretty good one. You can actually pause programs at a particular function or a line so that you can re-run the program n number of times from that breakpoint).

Some other powerful tools in GDB are :

  • display
  • info
  • continue
  • backtrace
  • frame


I am exploring all the cool stuffs that I can do with GDB and yeah, and it seems like I am getting the hang of it real quick.

perl: warning: Setting locale failed. – Fixed

Today when I was trying to build a package on a Debian VPS, It started reporting really annoying messages like these:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = “en_US.UTF-8”
are supported and installed on your system.
perl: warning: Falling back to the standard locale (“C”).

Then I was trying to install a new package, I got them again. Eventhough it doesn’t cause any harm, a screen full of such messages really is annoying. I googled it and found out that I am not the only person with this problem. I could find a couple of solutions for this and the easiest one worked for me. Run the following command in your terminal:

export LC_ALL=C

Now it has stopped complaining. 🙂