Tag Archives: Linux

Less is more: a little tips for reading log files with less

I tweeted about that recently but a tweet is not read by a lot of people so I write a short post here.

Have you ever wondered how to read a log file from the end?

Well, there is tail -100 logfile.log for instance, but if you haven’t find what you look for you must try with tail -200 logfile.log and so on (I don’t talk about tail -f logfile.log here).

No, I you want to read a log file but want to start from the end and search for a specific message, you can try less +G logfile.log. Life will be much easier then 🙂

How to change the timeout in GRUB2?

Sometimes booting your Linux system can be relatively long. It depends often on how many services your system needs to start while booting.

There’s also a phase which takes time: the boot-loader. It displays a menu in which you can choose which kernel to use or starting another operating system. If you don’t choose anything, there is a timeout and then the boot-loader picks up the default kernel/operating system.

Ubuntu 10.10 sets this timeout to 10 seconds which can be seen as long. It’s possible to change that.

How? Well the boot-loader used by Ubuntu is GRUB2. Since 9.10 (Karmic Koala) and the file for configuring it is /etc/default/grub.

In Ubuntu you need to use sudo for editing this file (replace emacs by your editor of choice):
sudo emacs /etc/default/grub

Then you need to find the setting GRUB_TIMEOUT and change its value to 3 seconds for instance:
GRUB_TIMEOUT=3

Save the file and you have done most of the work!

To achieve it, you need now to run update-grub to update the file /boot/grub/grub.cfg:
~$ sudo update-grub
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.35-22-generic
Found initrd image: /boot/initrd.img-2.6.35-22-generic
Found linux image: /boot/vmlinuz-2.6.32-25-generic
Found initrd image: /boot/initrd.img-2.6.32-25-generic
Found memtest86+ image: /boot/memtest86+.bin
Found Windows 7 (loader) on /dev/sda1
done
~$

You can now reboot your system if you want to test it 🙂