Why is this file name truncated in Nautilus?

In Ubuntu the “extension” to a file name, that is, the part after the dot (.) is normally visible. Why is Nautilus not showing the extension of eclipse.desktop when the ls command clearly shows that is the full file name?

This is the list view; not the icon view.


Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

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):


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.

Solution 2

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


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:


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:


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.

Solution 3

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.

Solution 4

At this link author “fragos” writes:

Unfortunately, if you open that folder in nautilus the .desktop files
appears with the icon specified in the file and with the file name
called out within the file.

When he says “file name called out within” he means the displayed file name is taken from within. I would say “file name called out within when the executable bit is set”. He may be right that this is unfortunate. Strangely I have some that have the execute bit set and some that do not. The ones that do NOT have the execute bit set are not a cause of misfortune but I don’t know why I was lucky. When the bit is set perhaps it can be considered a quirk or bug.

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply