Ubuntu: Desktop Shortcut Creation

This note describes two methods of how to create a desktop shortcut in Ubuntu from the command line.

The simplest method is to create the desktop shortcut as a symbolic link using the ln command.

The second method is a bit more complex but it allows to create much more customizable desktop shortcuts using the “Desktop Entry Specification”.

Cool Tip: Systemd service file examples! Read more →

Create Desktop Shortcut in Ubuntu

A simple desktop shortcut in Ubuntu can be created from the command line using ln:

$ ln -s <source> /home/<user>/Desktop/<shortcut-name>

The Link is Broken: To avoid this error – provide the full path to the <source>.

For example, a shortcut of the Chromium browser on the current user’s desktop may be created as follows:

$ which chromium-browser 
/usr/bin/chromium-browser

$ ln -s /usr/bin/chromium-browser ~/Desktop/Chromium

Much more customizable desktop shortcut in Ubuntu can be created as a “desktop entry” – the configuration file that describes how a particular program is to be launched.

To create such desktop shortcut in Ubuntu – create a file with the .desktop extension, e.g.:

$ touch ~/Desktop/app-launcher.desktop

Open this file in your favorite text editor and type in (copy-paste):

[Desktop Entry]

# "Application", "Link" or "Directory"
Type=Application

# The version of the Desktop Entry Specification
Version=1.0

# The name of the application
Name=sampleApp

# A comment which will be used as a tooltip
Comment=Ubuntu desktop shortcut demo

# The path to the folder in which the executable is run
Path=/opt/sampleApp

# The executable of the application, possibly with arguments
Exec=/opt/sampleApp/bin/start --debug

# The icon to display
Icon=/opt/sampleApp/misc/icon.png

# Describes whether this application needs to be run in a terminal or not
Terminal=false

# Describes the categories in which this entry should be shown
Categories=Utility;Application;

Make the desktop shortcut executable:

$ chmod +x ~/Desktop/app-launcher.desktop

A realistic example of how a .desktop file looks like:

[Desktop Entry]
Type=Application
Name=Arduino IDE
GenericName=Arduino IDE
Comment=Open-source electronics prototyping platform
Exec="/opt/arduino-1.8.12/arduino"
Icon=arduino-arduinoide
Terminal=false
Categories=Development;IDE;Electronics;
MimeType=text/x-arduino;
Keywords=embedded electronics;electronics;avr;microcontroller;
StartupWMClass=processing-app-Base

All possible settings can be found on the freedesktop site.