I've done a lot of trial and error and reading and can now create .desktop files (i.e., launchers, shortcuts, etc.) most of the time using Lubuntu.

But I'm unclear whether or not the ".desktop" extension is actually needed. It seems sometimes I've created a shortcut/launcher without it. Other times I've added the extension during file creation and later removed the extension and it still worked.

So, I'm wondering two things... Given that a .desktop file can be created and/or viewed from a text editor:

  1. Is the real, defining characteristic of a .desktop file the [Desktop Entry] at the top of the text file?
  2. Is it really necessary to right-click the desktop and create a new file with the .desktop extension? Or is it enough to create a new, empty file in a text editor and put the [Desktop Entry] as the header and fill in the remaining fields (Type=, Icon= , etc.).


2 Answers 2


Most desktop programs today use the Shared MIME-info Database to determine file types.

The MIME type definition for .desktop files is in the file /usr/share/mime/application/x-desktop.xml. In Ubuntu 16.04 the relevant lines are at the end of the file:

<glob pattern="*.desktop"/>
<glob pattern="*.kdelnk"/>

So most desktop programs will recognize a .desktop file only if it has a .desktop or .kdelnk extension, and the file content actually doesn't matter for that (but of course it will not work as a starter if the content is wrong).

There may be some cases where just a [Desktop Entry] line is enough but in general it's not.

It doesn't matter how you create a .desktop file. You can just use a normal text editor if you want.


For the answer to your first question, the answer is yes ... and no. Yes because this is part of the syntax the launcher manager program uses. No because it does not make it a .desktop file.

The second question the answer would be yes on file creation, but you can edit it to remove the .desktop. This is because when Ubuntu creates the file, in the binary data it says that it is a .desktop file. Then if you edit it, it will not update it and it will still work. Unless you can find the binary code needed, not on file creation.

  • Got it. That explains a lot. Your answer and Florian's completely answer my question. Thanks!
    – jackL
    Jun 14, 2016 at 1:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.