Software & AppsOperating SystemLinux

How To Find Missing *.desktop Files in Unity Launcher

Ubuntu 12

In this article, we will discuss how to find missing *.desktop files in the Unity launcher. These files are essentially shortcuts to launch your applications, and sometimes they can go missing or not function correctly. Fortunately, there are several ways to find and fix these files.

Quick Answer

To find missing *.desktop files in the Unity launcher, you can use the find or locate commands in the terminal to search for these files in the system. Additionally, you can navigate to specific directories where these files are usually stored and use the ls command to list the files. Once you have located the missing file, you can edit it using a text editor like gedit.

Understanding *.desktop Files

*.desktop files are application shortcuts used by the Unity launcher (and other Linux desktop environments) to display and launch applications. They contain metadata about the application, such as its name, icon, and the command to run it. These files are typically located in directories like /usr/share/applications/, ~/.local/share/applications, and /usr/local/share/applications.

Finding *.desktop Files

Using the find Command

One of the easiest ways to find *.desktop files is by using the find command in the terminal. Here is the syntax:

find / -name '*.desktop'

This command will search the entire filesystem (/) for files ending with .desktop. The -name parameter specifies the name of the files to look for.

Using the locate Command

Another useful command is locate. This command can find files much faster than find, but it relies on a database that is updated periodically. Here is an example:

locate *.desktop

This command will return a list of all .desktop files in the system. If you’re looking for a specific file, you can include part of its name in the command, like so:

locate -i "*skrooge*.desktop"

The -i option makes the search case-insensitive, and the * before and after “skrooge” allows for any characters before or after the word.

Checking Specific Directories

As mentioned earlier, *.desktop files are usually stored in certain directories. You can navigate to these directories in the terminal and use the ls command to list the files:

cd /usr/share/applications/
ls

This will change the current directory to /usr/share/applications/ and list all files in it.

Editing *.desktop Files

To edit a *.desktop file, you can use a text editor like gedit. For example:

gksudo gedit /usr/share/applications/{file-name}.desktop

This command will open the specified file in gedit with root permissions, allowing you to edit it. Be sure to replace {file-name} with the actual name of the file.

However, be aware that changes to *.desktop files in system directories may be overwritten when the application is updated. To avoid this, it’s recommended to copy the file to ~/.local/share/applications and edit it there:

cp /usr/share/applications/{file-name}.desktop ~/.local/share/applications/
gksudo gedit ~/.local/share/applications/{file-name}.desktop

This will copy the file and open the copied file in gedit.

Conclusion

Finding and editing *.desktop files can be a straightforward process once you understand where these files are typically located and how to use commands like find and locate. Whether you’re troubleshooting a missing application shortcut or customizing your Unity launcher, these techniques can be very helpful.

How do I know if a `*.desktop` file is missing in the Unity launcher?

You can identify a missing *.desktop file in the Unity launcher if the application shortcut is not displayed or if clicking on the shortcut does not launch the application.

What should I do if I find a missing `*.desktop` file?

If you find a missing *.desktop file, you can try to locate it using the methods mentioned in the article. Once you find the file, you can either edit it to fix any errors or copy it to ~/.local/share/applications and edit it there to avoid overwriting changes during application updates.

How can I edit a `*.desktop` file?

To edit a *.desktop file, you can use a text editor like gedit. Open the file using the appropriate command mentioned in the article, make the necessary changes, and save the file. Remember to use root permissions when editing files in system directories.

Will editing a `*.desktop` file affect the application?

Editing a *.desktop file will not directly affect the application itself. However, if you make incorrect changes, it may cause the application shortcut to not function properly or not appear in the Unity launcher. It’s important to be cautious when making changes and ensure that the file syntax and paths are correct.

Can I restore a deleted `*.desktop` file?

If you have accidentally deleted a *.desktop file, you can try to restore it from a backup if you have one. Otherwise, you may need to reinstall the application associated with the file to restore the shortcut.

Leave a Comment

Your email address will not be published. Required fields are marked *