Desktop Files in Ubuntu
Understanding Desktop Files in Ubuntu
In Ubuntu, applications are represented in the launcher or “Show Apps” grid through .desktop
files. These files act as shortcuts, defining how an application is started, what icon it uses, and how it appears in menus. Several different folders on the system store these files, each serving a particular purpose.
/usr/share/applications/
System-wide applications are placed here. When software is installed throughapt
or.deb
packages, the installer automatically creates a.desktop
file in this directory, making the application available to all users.~/.local/share/applications/
Applications installed for a single user, or manually added shortcuts, are stored in this directory. Standalone formats such as AppImage do not generate.desktop
files on their own; if an entry in the launcher is desired, one must be created manually and placed here.~/.config/autostart/
This directory holds.desktop
files for applications that should start automatically at login. Some applications add themselves here when the “autostart” option is enabled. Others, such as AppImages without built-in autostart support, require a.desktop
file to be copied or created in this folder.~/Desktop/
This is the user’s visible desktop folder. Placing a.desktop
file here will show an icon directly on the desktop if the desktop environment supports it. In GNOME, icons are disabled by default, so this folder is often unused.
Installation Methods and Their Effect
- APT or
.deb
packages: automatically generate.desktop
entries in/usr/share/applications/
. - AppImages: provide only a portable binary. A
.desktop
file must be created manually under~/.local/share/applications/
to appear in the app grid. - Snap and Flatpak: handle
.desktop
integration automatically in the background, similar to.deb
.
Creating a Desktop File Manually
A simple .desktop
file can be created with a text editor. For example, for an AppImage:
[Desktop Entry]
Name=MyApp
Exec=/home/username/Applications/MyApp.AppImage
Icon=/home/username/Applications/myapp.png
Type=Application
Categories=Utility;
Save this file as myapp.desktop
in ~/.local/share/applications/
and run:
chmod +x ~/.local/share/applications/myapp.desktop
The application will then appear in the launcher with its icon.
Adding to Autostart
To run the same application at login, copy the .desktop
file into ~/.config/autostart/
:
cp ~/.local/share/applications/myapp.desktop ~/.config/autostart/
This ensures the application launches automatically every time the session begins.