Nightly icon cache update for Gnome

Sometimes it happened on my Ubuntu system, that a newly added application didn't had its icon.
This can happen due to an not updated icon cache of GTK.
This can be fixed with the command
gtk-update-icon-cache
, which rebuilds the GTK+ icon cache.

So why don't do this automatically in the background on a daily basis (during the night)?

Install instructions

Just execute the following commands, which will put a script into /etc/cron.daily so that the cache is fixed and the missing icon appears overnight.
sudo -i
echo '#!/bin/sh
#
# 

for theme in $(find /usr/share/icons -mindepth 1 -maxdepth 1 -type d)
do 
    if [ -f "$theme/index.theme" ]
    then gtk-update-icon-cache -f -q "$theme"
    fi
done

exit 0' > /etc/cron.daily/update-icon-cache
chmod a+x /etc/cron.daily/update-icon-cache

Open URL in Firefox with middle mouse button

Often I copy an URL somewhere and want to open it in a new tab in Firefox.
Normal steps:
  • Open a new tab with Ctrl-T
  • Click into the URL address bar
  • Paste the URI and press Enter
Wouldn't it be nice to make all these steps in one, f.ex. by clicking with the middle mouse button on the current tab.

Firefox has this possibility, but you can't enable it from the normal preference dialog.
Instead you have to alter the configuration parameters directly.

Install instructions

  • Navigate to about:config
  • Put middlemouse.contentLoadURL in the filter bar
  • Press the right mouse button over the option and select toggle, so it's value is true.
Now lets test it:
  • select and copy this text: www.ubuntu.com 
  • press the middle mouse button in the window where you're reading this post
  • A new browser tab should appear with the Ubuntu site.

Flash Video in Linux and Webcam

You also experienced problems when trying to use a webcam from a flash application in your Firefox browser?
It claimed about not being able to detect the cam, whereas VLC finds and uses it perfectly.

Well, there's a known compatibility limitation between the underlying video-for-linux (v4l) layer.
Modern Linux systems use version 2, whereas the Flash applets seem to be comfortable only with version 1.

There's a possibility to force Firefox to use the version 1 of v4l, by launching it this way:
LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so firefox &

Now the Flash applet should be able to detect and use your webcam.

More details can be found in this article I found.

Disk Defragmentation

Defragmenting your disks file-systems can be important for several reasons:
  • Lots of fragments are slowing down your systems performance (especially true for any Windows systems).
  • You may want to shrink a partition and therefore need to move all files to get all available space at the end of the partition.
I needed to shrink my NTFS partition, because I want to give more space to my Ubuntu one, but even if it claimed to have 26 GB free, I could only shrink about 300 MB.
Why?
Because NTFS uses a MFT table for allocating, which could be anywhere and unfortunately, it will be in most cases at the end of the partition.
And almost any defragmentation program is able to move it.

Since I found Perfect Disk. It is not free-ware, but its one month evaluation was enough to finally claim all free space to the end of the partition and get it shrunk with GParted.

Until then, I tested several programs (because Windows XP internal tool isn't the optimum), and I'll list them here.

Perfect Disk


Perfect Disk is simply perfect. It makes it job as one thinks it should. Can defrag your MFT, pagefile, hyberfile in offline mode, its defragmentation algorithms seem to be very clever, can choose each algorithm automatically adapted to the file-systems state, scheduled tasks, during screensaver, and the interface is clean and nice.

O&O Defrag


O&O Defrag is similar to Perfect Disk, but finally wasn't able to move the MFT, but has more algorithms than Perfect Disk. It seems to be more slower during defragmentation than the other one. Isn't free-ware too.

MyDefrag


MyDefrag is freeware, and has a very different concept to other tools. Internally, it uses scripts that define the algorithm, and even if there are several ones included already, you could write your own ones. Its interface is ugly, but includes screensaver mode. Can handle floppies, USB disks, memory sticks, and anything else that looks like a disk to Windows.

Auslogic Disk Defrag


Auslogic tools is a simple disk defrag tool, with a nice interface. Does its job better than Windows included one and is free-ware too. Can defrag a single file or folder and includes a scheduler.

Defraggler


Use Defraggler to defrag your entire hard drive, or individual files - unique in the industry. This compact and portable Windows application supports NTFS and FAT32 file systems. Lets you specify one or more files, folders, or the whole drive to defragment. Very simple and supports quick defrag.

WinContig


WinContig is an easy-to-use stand-alone defragmentation tool that doesn't create any installation directories or Registry entries on your computer. Its purpose is to quick defrag files without the need to defrag the whole disk. In addition, WinContig allows you to group files into profiles, and also it accepts a number of optional command-line switches that you can use to control how the program operates.

SysInternal Tools


SysInternals also has some tools for defragmentation working directly on single files which can help out in some cases.

Contig


Contig is a single-file defragmenter that attempts to make files contiguous on disk. Its perfect for quickly optimizing files that are continuously becoming fragmented, or that you want to ensure are in as few fragments as possible.

PageDefrag


PageDefrag uses advanced techniques to provide you what commercial defragmenters cannot: the ability for you to see how fragmented your paging files and Registry hives are, and to defragment them. In addition, it defragments event log files and Windows 2000/XP hibernation files (where system memory is saved when you hibernate a laptop).

SystemRescueCD from ISO image

The new grub loader shipped with Ubuntu Lucid is able to boot systems directly from ISO images located in any hard disc partition.

Lets use this fact and have always the latest SystemRescueCD at hand, without having to burn a new CD, just by having its ISO on our Ubuntu partition.

There are some instructions on their web-site, but
  1. they don't work

  2. why not use grub's update mechanism to include the SystemRescueCD entry automatically, instead of having to add it by hand.


Therefore, grub offers to have some scripts in /etc/grub.d which are called during the update process and I'll give you here the steps for adding the ISO image as entry "magically".

Install instructions


  1. Download latest SystemRescueCD image from their web.

  2. Move it somewhere inside the /boot folder, for example I use a subfolder:
    sudo mkdir /boot/sysrcd
    sudo mv systemrescuecd*.iso /boot/sysrcd/

  3. Create a new file /etc/grub.d/50_sysrcd and put the following content:
    #!/bin/sh

    # Search for System Rescue CD iso file in /boot and add it as boot-entry.

    for iso in $(find /boot -name systemrescuecd*.iso)
    do
    isofile=`echo $iso`
    version=`echo $iso | cut -d "-" -f 3 | cut -d "." -f 1,2,3`
    echo "Found SystemRescueCD image: ${iso}" >&2
    cat << EOF
    menuentry "SystemRescueCd ${version}" {
    loopback loop ${isofile}
    linux (loop)/isolinux/rescuecd isoloop=${isofile}
    initrd (loop)/isolinux/initram.igz
    }
    EOF
    done

  4. Make it executable:

  5. sudo chmod a+x /etc/grub.d/50_sysrcd

  6. Now, we are ready to update the grub menu:
    sudo update-grub


That's it, now when you reboot your system, you should see the SystemRescueCD as latest entry and you can just boot it up.

You could also have several versions of the ISO images in /boot/sysrcd and this will give several grub entries.

Nice if you need to tweak your system partitions, need to recover something from your broken Windows partition, you just have the tools there, and it only occupies about 250 MB on your Linux partition.
And whenever you want to use a newer version, just download the new one, replace the old ISO, and update the grub menu again.

Troubleshooting


If you get these messages during update-grub
Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst

and
Updating /boot/grub/menu.lst ... done

this means that you still using grub version 1, not the latest one.
In that case, you should first upgrade grub with
sudo aptitude install grub2

Create a bootable Live USB drive with UNetbootin


UNetbootin is a cross-platform utility that can create Live USB systems and can load a variety of system utilities or install various Linux distributions and other operating systems without a CD.

Install instructions

sudo add-apt-repository ppa:gezakovacs/ppa
sudo aptitude update
sudo aptitude install unetbootin

Remove Evolution

Personally, I prefer Thunderbird for mailing than the preinstalled Evolution.
If you share the same preference, surely you tried to remove Evolution from your system, just to run into a dead-end, because several packages depend on it, especially one meta package.
Evolution seems to be embedded into Ubuntu like IExplorer in Windows.

But yesterday I found some Spanish article explaining how to remove it from the system, leaving about 56 MB of free space on your system.
I just added two more packages to the de-installation instruction that where missing for my Ubuntu 9.10 system.

Deinstall instructions


sudo aptitude purge evolution-indicator evolution evolution-documentation-en evolution-common evolution-data-server evolution-webcal evolution-plugins evolution-couchdb evolution-exchange mail-notification-evolution

Setup GDM2 startup graphically


GDM2Setup is a graphical tool that allows us to setup the new GDM2 included since Ubuntu Karmic.

After installation, a new entrance in the menu appears: System > Administration > Login Screen (GDM2Setup)

See also my post about other graphical setup tools for the Ubuntu bootup process.

Install instructions


sudo add-apt-repository ppa:gdm2setup/gdm2setup
sudo apt-get update
sudo apt-get install python-gdm2setup

Extract email attachments from winmail.dat files

tnef is a program for unpacking MIME attachments of type "application/ms-tnef". This is typically a Microsoft only attachment, named winmail.dat.
This program allows one to unpack the attachments which were encapsulated into the TNEF attachment, thus alleviating the need to use Microsoft Outlook to view the attachment.

Install instructions


sudo aptitude install tnef
or click here.

Usage


Save the winmail.dat file from the email and execute
tnef --list winmail.dat  # list containing files
tnef winmail.dat # unpack containing attachments

Notifications integrated with Thunderbird 3

Libnotify extension
With Thunderbird 2.0.x it was possible to integrate with Ubuntus notification system.

The Libnotify plugin intents to improve the integration with libnotify. With this plugin, Firefox and Thunderbird will display notification message like "new mail received", "download complete" using the libnotify library. For now, only Thunderbird displays notifications, but it stopped working with release 3.x

The latest beta release solves the problems and works with TB 3 like a charm.

Install instructions


Download the extension from here and install it from inside Thunderbird.
You can also have a look at the list of beta releases, in case a newer one is available after having written this post.

Tweaking Ubuntu

There exist applications that provide many useful desktop and system options that the default desktop environment doesn't provide or are hard to find inside the Gnome configuration.

The following applications complete very well and you should use both of them, as each one offers a different set of tweaking options.

Ubuntu-Tweak




Ubuntu Tweak is an application designed to adjust Ubuntu easier for everyone, handling package caches, tweaking nautilus, offering a bunch of application to install.

Install instructions


sudo add-apt-repository ppa:tualatrix/ppa
sudo apt-get update && sudo apt-get install ubuntu-tweak


Ailurus



Ailurus is a similar Ubuntu enhancement application. It can install/remove applications which do not provide Debian packages at all. It can change system settings. Moreover, it can detect which Ubuntu repository is the fastest one for your connection.

Install instructions


sudo add-apt-repository ppa:ailurus
sudo apt-get update && sudo apt-get install ailurus