Eye of GNOME does not load JPG

Problem

I tried to open a JPG image file using Eye of GNOME. It failed with this error:

Could not load image 'foo.jpg'
Error interpreting JPEG image file (Not a JPEG file: starts with 0x89 0x50)

When I opened the same file using another image viewer, it opened without any problem!

Another symptom of this problem is that the thumbnail of the image file is not displayed in Nautilus or in Nemo file explorers. All of these programs use the same backend for image display.

Solution

This problem is typically caused when the image is actually a PNG file. Some apps on Android are notorious for saving all image formats as JPG.

As noted by EOG, the file starts with the magic identifier 0x89 0x50, which is for PNG format. You can also check the same by using the file command:

$ file foo.jpg
foo.jpg: PNG image data, 716 x 960, 8-bit/color RGB, non-interlaced

We can see that file reports this JPG file as containing PNG image data.

Just rename the JPG file with the correct .png file extension and EOG will open it correctly. You will also see that thumbnails are now rendered correctly.

Admittedly, EOG could have detected the format correctly and shown a more informative error message. I have seen other image viewers do that. This has been filed as a bug here.

Tried with: Eye of GNOME 3.10.2 and Ubuntu 14.04

How to set Nemo as default file manager

I find the Nautilus in recent Ubuntu versions quite irritating. Several nice features have been removed. Thankfully, Nemo, a fork of Nautilus, still has those features.

To make Nemo the default manager:

$ xdg-mime default nemo.desktop inode/directory application/x-gnome-saved-search

To make Nemo handle the desktop:

$ gsettings set org.gnome.desktop.background show-desktop-icons false
$ gsettings set org.nemo.desktop show-desktop-icons true

Warning: Do not use exo-preferred-applications utility to set Nemo as default file manager. It works, but disables xdg-open.

Tried with: Nemo 1.8.4 and Ubuntu 14.04

Nemo File Manager

Nemo is a file manager for Linux that is a fork of Nautilus. In recent versions of GNOME or Ubuntu, Nautilus has been simplified and lots of features have been removed. For example, I like to use Compact View and this has been removed in the Nautilus in Ubuntu 14.04. If you need a file manager that is similar to the old Nautilus, but having a good set of features, then pick Nemo.

If you are using an older version of Ubuntu, add the PPA:

$ sudo add-apt-repository ppa:webupd8team/nemo
$ sudo apt-get update

Installing Nemo is the same in all versions of Ubuntu:

$ sudo apt-get install nemo

If you would like to make Nemo your default file manager, please see this post.

Tried with: Nemo 2.0.8 and Ubuntu 12.04

How to kill and restart Nautilus

Nautilus is the default file explorer used in Ubuntu. Sometimes, you may need to kill and restart it to see the effect of installing or removing a program.

The easiest way to kill Nautilus is:

$ nautilus -q

You can restart it after this. If that does not work, you may need to log out and log back in. But, this is almost never needed.

Tried with: Nautilus 3.4.2 and Ubuntu 12.04 LTS

How to install Pantheon Files on Ubuntu

Pantheon Files is one of the many file managers available for Ubuntu. These file managers offer features that are not present in the default Nautilus file manager. One of the features I like in Pantheon Files is its Column View, where it allows navigation using Miller columns. This is similar to the column navigation in the Finder application on the Mac.

To install Pantheon Files, first add the PPA repository ppa:elementary-os/daily and update. Next, install it by using the package name pantheon-files.

$ sudo add-apt-repository ppa:elementary-os/daily
$ sudo apt-get update
$ sudo apt install pantheon-files

To launch Pantheon Files, type Files in the Ubuntu Launcher.

Tried with: Pantheon Files 0.1 and Ubuntu 12.04 LTS

How to remove duplicate entry in Devices list in Nautilus

Problem

The Devices list shown at the top of the Sidebar in Nautilus lists the other partitions found in the hard disk or any other storage devices plugged into the computer. Since I dual-boot between Windows and Ubuntu, the Devices list shows the NTFS partitions on the hard disk. I added a line to /etc/fstab to mount one of my NTFS partitions automatically at boot. After I did this, the Devices list in Nautilus started to show a duplicate entry for this partition, with one of it mounted and the other unmounted.

Solution

There seems to be a simple solution to this bizarre problem. The fstab entry I am using to mount the NTFS partition uses the UUID of the partition. Replacing this with the old style /dev/sda partition name fixed this problem.

For example, my fstab entry read UUID=A5190634180941Z5. I changed that to /dev/sda5 You can list the dev and UUID entries for all your partitions by using the command sudo blkid

Tried with: Ubuntu 12.04.2 LTS

Keyboard shortcut to open Nautilus in Ubuntu

Nautilus is the file explorer in Ubuntu. One keyboard shortcut to open it is Win + 1. This will only work if Nautilus is locked to the Launcher and it is the first icon below the Dash icon.

Another is to just use the Dash. Press the Win key, which opens the Dash. Now type the letters of the word nautilus until it appears as the first icon in the search results and then press Enter.

Tried with: Ubuntu 12.04.1 LTS

Nautilus: Icon Text Width in Compact View

[ Before: Filenames truncated to 17 characters. After: Full filename displayed. ]

Nautilus, the default file manager in Ubuntu, offers 3 kinds of views: icon, list and compact. The compact view in Nautilus is similar to the list view in Windows Explorer and this is my preferred way of viewing files. However, the compact view displays only the first 17 characters of the filename. I find this quite irritating since I tend to use longer filenames.

To remove this restriction on the displayed icon text width, open gconf-editor, navigate to /apps/nautilus/compact_view and uncheck the option all_columns_have_same_width.

Tried with: Nautilus 2.30.1 and Ubuntu 10.04 (Lucid Lynx)