Why is this file name truncated in Nautilus?

Quoting from Ubuntu's security policy:

Execute-Permission Bit Required

  • Applications, including desktops and shells, must not run executable code from files when they are both:

    • lacking the executable bit
    • located in a user's home directory or temporary directory.
  • This includes *.desktop, *.jar, and *.exe files.

What is a valid .desktop file under user's home directory?

According to Ubuntu's security policy the execution permission in .desktops files and shells script is a must to run executable code from those files when they are located in a user's home directory.

Nautilus will not consider a .desktop file as valid application shortcuts unless it has executable bit when they are located in a user's home directory.

On the other hand it is hard coded in nautilus's source code that it will show a valid .desktop file's name from the Name= or Name[$LANG] field inside the .desktop file ignoring the filename and extension. This does not apply to .sh or .jar files in nautilus.

Example: On a fresh Ubuntu installation every user gets examples.desktop in their home directory. The file name is examples.desktop. But in nautilus one can see it as Examples. If you look inside the .desktop file you can see following (I am showing only part of it):

Name=Examples
Name[aa]=Ceelallo
..
Name[en_AU]=Examples
Name[en_CA]=Examples
Name[en_GB]=Examples
..

You can check the permission (try ls -la /path/to/filename.extension) of Eclipse.desktop and smartgit.desktop. The former has executable bit set whereas the later has not.

That is why nautilus is recognizing Eclipse.desktop as application shortcuts and not showing its extension.


About .desktop files and their special function

.desktop files are special files. They represent applications in the GUI, either on your desktop or in Dash/Unity. To do so, a GUI -name of the application is set in a line inside the file in the line

Name=Eclipse

You can simply change the name of how the application shows in Dash and Unity, by changing this line inside the .desktop file, without changing the file name of the .desktop file. In that case, it is irrelevant if the file is executable or not.

If the .desktop file is on your desktop however, if it is not executable, it does not work as a launcher, for reasons explained in souravac's answer, and "shows" under its own (file) name:

eclipse.desktop

If it is executable and on your desktop, it works as a launcher and so it is is representing an application. Then it shows the application's name, as set in the line Name=

Language specific name

If the .desktop file has the line:

X-Ubuntu-Gettext-Domain

the file even shows a language- specific name, fetched from a language file, which will then show in Dash and Unity.


below a complicated example: filename = inkskape.desktop, "basic" interface name = Inkskape, translated name = Inkskape Vector Graphics Editor

enter image description here

The ls command

In the ls command is purely cli- based and always shows the file -name.


If a .desktop file is executable then Nautilus will recognize it as a desktop shortcut and will not display the name of the file, but rather the string set as the value of the Name= property in the file.